﻿# 导入库模块
import pandas as pd
import numpy as np

# 读取参数
ROUTE = 'C:\PY\T_Girder.xlsx'
GENERAL_INFO = pd.read_excel(ROUTE,sheet_name='GENERAL_INFO',index_col='GENERAL_INFO',header=0)
TGIRDER_LEN = pd.read_excel(ROUTE,sheet_name='TGIRDER_LEN',index_col=0,header=[0,1])
TGIRDER_CROSS = pd.read_excel(ROUTE,sheet_name='TGIRDER_CROSS',index_col=0,header=[0,1])
LEVEL_DATA = pd.read_excel(ROUTE,sheet_name='LEVEL_DATA',index_col='P_NOS',header=0)
LOAD_CASE = pd.read_excel(ROUTE,sheet_name='LOAD_CASE',index_col='LOAD_CASE',header=0)
SOIL_SPRING = pd.read_excel(ROUTE,sheet_name='SOIL_SPRING',header=[0,1])

# 新建写入结果文件
result = open('reslut.mct', 'w')

# 定义跨径类型JN节点函数
def SPAN_JN_TYPE(SPAN):
   if float(SPAN_LEN[SPAN]) == float(TGIRDER_LEN.columns[0][1]):
      JN = 15
      TTYPE = 0
   elif float(SPAN_LEN[SPAN]) == float(TGIRDER_LEN.columns[1][1]):
      JN = 13
      TTYPE = 1
   else:
      JN = 13
      TTYPE = 2
   return JN,TTYPE

# 定义版本号及单位
result.write('''*VERSION
   9.0.0

*UNIT    ; Unit System
; FORCE, LENGTH, HEAT, TEMPER
   KN   , M, KJ, C
   ''')

# 定义材料特性
result.write('''
*MATERIAL    ; Material
    1, CONC , C50               , 0, 0, , C, NO, 0.05, 2, 3.4000e+007,   0.2, 1.2000e-005,    25,     0
    2, CONC , C50-ZERO WEIGHT   , 0, 0, , C, NO, 0.05, 2, 3.4000e+007,   0.2, 1.2000e-005,     0,     0
    3, CONC , C40               , 0, 0, , C, NO, 0.05, 2, 3.1000e+007,   0.2, 1.2000e-005,    25,     0
    4, CONC , C30               , 0, 0, , C, NO, 0.05, 2, 2.8000e+007,   0.2, 1.2000e-005,    25,     0
    5, CONC , ASPHALT           , 0, 0, , C, NO, 0.05, 2, 1.0000e+006,   0.2, 1.2000e-005,     0,     0
''')

# 定义截面特性
# 定义30mT梁截面
result.write('''
*SECTION    ; Section
    1, PSC       , T-GIRDER-MID-1      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')

result.write('''
    2, PSC       , T-GIRDER-END-1      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')

result.write('''
    3, TAPERED   , TAPERED(E-M)-1      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')

result.write('''
    4, TAPERED   , TAPERED(M-E)-1      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[0]]))+','+str(float(TGIRDER_CROSS.iloc[1,[0]]))+','+str(float(TGIRDER_CROSS.iloc[2,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[0]]))+','+str(float(TGIRDER_CROSS.iloc[4,[0]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[0]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[0]]))+','+str(float(TGIRDER_CROSS.iloc[7,[0]]))+','+str(float(TGIRDER_CROSS.iloc[8,[0]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[0]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[3]]))+','+str(float(TGIRDER_CROSS.iloc[1,[3]]))+','+str(float(TGIRDER_CROSS.iloc[2,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[3]]))+','+str(float(TGIRDER_CROSS.iloc[4,[3]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[3]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[3]]))+','+str(float(TGIRDER_CROSS.iloc[7,[3]]))+','+str(float(TGIRDER_CROSS.iloc[8,[3]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[3]]))+',0,0'+'\n')

# 定义25mT梁截面
result.write('''
    101, PSC       , T-GIRDER-MID-2      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')

result.write('''
    102, PSC       , T-GIRDER-END-2      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')

result.write('''
    103, TAPERED   , TAPERED(E-M)-2      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')

result.write('''
    104, TAPERED   , TAPERED(M-E)-2      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[1]]))+','+str(float(TGIRDER_CROSS.iloc[1,[1]]))+','+str(float(TGIRDER_CROSS.iloc[2,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[1]]))+','+str(float(TGIRDER_CROSS.iloc[4,[1]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[1]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[1]]))+','+str(float(TGIRDER_CROSS.iloc[7,[1]]))+','+str(float(TGIRDER_CROSS.iloc[8,[1]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[1]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[4]]))+','+str(float(TGIRDER_CROSS.iloc[1,[4]]))+','+str(float(TGIRDER_CROSS.iloc[2,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[4]]))+','+str(float(TGIRDER_CROSS.iloc[4,[4]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[4]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[4]]))+','+str(float(TGIRDER_CROSS.iloc[7,[4]]))+','+str(float(TGIRDER_CROSS.iloc[8,[4]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[4]]))+',0,0'+'\n')


# 定义20mT梁截面
result.write('''
    201, PSC       , T-GIRDER-MID-3      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')

result.write('''
    202, PSC       , T-GIRDER-END-3      , CT, 0, 0, 0, 0, 0, 0, YES, NO, PSCI
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0,  YES, NO
       NO, , NO, , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')

result.write('''
    203, TAPERED   , TAPERED(E-M)-3      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')

result.write('''
    204, TAPERED   , TAPERED(M-E)-3      , CT, 0, 0, 0, 0, 0, 0, 0, 0, YES, NO, PSCI, 1, 1, PSC
       , , NO, YES, NO, NO, NO, YES, NO, NO, NO
       YES, YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  YES, 0, YES, 0, YES, 0, YES, 0,  0, 0,  NO, NO
       NO, , NO, , , , , , , , , , , ,
       NO, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
''')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[2]]))+','+str(float(TGIRDER_CROSS.iloc[1,[2]]))+','+str(float(TGIRDER_CROSS.iloc[2,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[2]]))+','+str(float(TGIRDER_CROSS.iloc[4,[2]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[2]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[2]]))+','+str(float(TGIRDER_CROSS.iloc[7,[2]]))+','+str(float(TGIRDER_CROSS.iloc[8,[2]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[2]]))+',0,0'+'\n')
result.write('       0,'+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[0,[5]]))+','+str(float(TGIRDER_CROSS.iloc[1,[5]]))+','+str(float(TGIRDER_CROSS.iloc[2,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[3,[5]]))+','+str(float(TGIRDER_CROSS.iloc[4,[5]]))+',0,0,'+str(float(TGIRDER_CROSS.iloc[5,[5]]))+'\n')
result.write('       '+str(float(TGIRDER_CROSS.iloc[6,[5]]))+','+str(float(TGIRDER_CROSS.iloc[7,[5]]))+','+str(float(TGIRDER_CROSS.iloc[8,[5]]))+',0,'+
      str(float(TGIRDER_CROSS.iloc[9,[5]]))+',0,0'+'\n')

# 定义端/中横隔板
result.write('   5, DBUSER    , END DIAPHRAGM, CT, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+str(GENERAL_INFO.loc['END_DIAPHRAGM_HEIGHT']['VALUE'])+
      ','+ str(GENERAL_INFO.loc['END_DIAPHRAGM_THICK']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   6, DBUSER    , MID DIAPHRAGM, CT, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+str(GENERAL_INFO.loc['MID_DIAPHRAGM_HEIGHT']['VALUE'])+
      ','+ str(GENERAL_INFO.loc['MID_DIAPHRAGM_THICK']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')

# 定义下部结构截面
result.write('   7, DBUSER    , COLUMN, CC, 0, 0, 0, 0, 0, 0, YES, NO, SR , 2,'+ str(GENERAL_INFO.loc['COLUMN_DIA']['VALUE'])+
      ','+' 0, 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   8, DBUSER    , PILE, CC, 0, 0, 0, 0, 0, 0, YES, NO, SR , 2,'+ str(GENERAL_INFO.loc['PILE_DIA']['VALUE'])+
      ','+' 0, 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   9, DBUSER     , CAST-IN-SITU, CT, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+ str(GENERAL_INFO.loc['GIRDER_HIGHT']['VALUE'])+
      ','+str(GENERAL_INFO.loc['WET_SLAB_MID']['VALUE'])+','+'0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   10, DBUSER    , RESTRAINT BLOCK LEFT-PIER, LC, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+
      str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+','+str(GENERAL_INFO.loc['BLOCK_THICK']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   11, DBUSER    , RESTRAINT BLOCK RIGHT-PIER, RC, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+
      str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+','+str(GENERAL_INFO.loc['BLOCK_THICK']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('   12, DBUSER    , PIER CAPPING BEAM, CC, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+
      str(GENERAL_INFO.loc['CAP_HEIGHT']['VALUE'])+','+str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')

result.write('   13, TAPERED   , PIER CAPPING TAPERED-RHS, CT, 0, 1, 0, 0, 0, 1, 0.8, 0.8, YES, NO, SB , 1, 1, USER'+'\n')
result.write('      '+str(GENERAL_INFO.loc['CAP_END_HEIGHT']['VALUE'])+','+ str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+', 0, 0, 0, 0, 0, 0,'+
      str(GENERAL_INFO.loc['CAP_HEIGHT']['VALUE'])+','+str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+', 0, 0, 0, 0, 0, 0'+'\n')

result.write('   14, TAPERED   , PIER CAPPING TAPERED-LHS, CT, 0, 1, 0, 0, 0, 1, 0.8, 0.8, YES, NO, SB , 1, 1, USER'+'\n')
result.write('      '+str(GENERAL_INFO.loc['CAP_HEIGHT']['VALUE'])+','+ str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+', 0, 0, 0, 0, 0, 0,'+
      str(GENERAL_INFO.loc['CAP_END_HEIGHT']['VALUE'])+','+str(GENERAL_INFO.loc['CAP_WIDTH']['VALUE'])+', 0, 0, 0, 0, 0, 0'+'\n')

result.write('15, DBUSER    , TIE BEAM          , CC, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+ str(GENERAL_INFO.loc['TIE_HEIGHT']['VALUE'])+
      ','+ str(GENERAL_INFO.loc['TIE_ WIDTH']['VALUE'])+','+ '0, 0, 0, 0, 0, 0, 0, 0'+'\n')

# 定义湿接缝截面
result.write('16, DBUSER    , WET SLAB_SIDE , CT, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,'+ str(GENERAL_INFO.loc['WET_SLAB_HEIGHT']['VALUE'])+','+
      str(GENERAL_INFO.loc['WET_SLAB_SIDE']['VALUE'])+', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')
result.write('17, DBUSER    , WET SLAB_MID, CT, 0, 0, 0, 0, 0, 0, YES, NO, SB , 2,' + str(GENERAL_INFO.loc['WET_SLAB_HEIGHT']['VALUE'])+','+
      str(GENERAL_INFO.loc['WET_SLAB_MID']['VALUE']) +', 0, 0, 0, 0, 0, 0, 0, 0'+'\n')

# 定义虚拟横梁截面
result.write('''
   18, DBUSER    , DUMMY WET SLAB-2.25, CT, 0, 1, 0, 0, 1, 0, YES, NO, SB , 2, 0.2, 2.25, 0, 0, 0, 0, 0, 0, 0, 0
   19, DBUSER    , DUMMY WET SLAB-2.5, CT, 0, 1, 0, 0, 1, 0, YES, NO, SB , 2, 0.2, 2.5, 0, 0, 0, 0, 0, 0, 0, 0
   20, DBUSER    , DUMMY WET SLAB-1.3, CT, 0, 1, 0, 0, 1, 0, YES, NO, SB , 2, 0.2, 1.3, 0, 0, 0, 0, 0, 0, 0, 0
   21, DBUSER    , DUMMY WET SLAB-1.525, CT, 0, 1, 0, 0, 1, 0, YES, NO, SB , 2, 0.2, 1.525, 0, 0, 0, 0, 0, 0, 0, 0
''')

# 定义桥面板单元厚度
result.write('''
*THICKNESS    ; Thickness
''')
result.write('1, VALUE, 2, YES,'+str(GENERAL_INFO.loc['ASPHALT_HEIGHT']['VALUE'])+', 0,  NO, 0, 0'+'\n')

# 定义跨数跨径桥宽分布
SPAN_NOS = GENERAL_INFO.loc['SPAN_NOS']['VALUE']
SPAN_LEN = GENERAL_INFO.loc['SPAN']['VALUE'].split(',')
IN = 2*GENERAL_INFO.loc['GIRDER_NOS']['VALUE']+1
CROSS_DIS = []
CROSS_DIS0 = float(0)
for I in range(IN):
    if I == 0:
        CROSS_DIS0 = GENERAL_INFO.loc['WET_SLAB_SIDE']['VALUE']/2
    elif I == IN-1:
        CROSS_DIS0 = GENERAL_INFO.loc['BRIDGE_WIDTH']['VALUE'] - GENERAL_INFO.loc['WET_SLAB_SIDE']['VALUE'] / 2
    elif (I+1) % 2 == 0:
        CROSS_DIS0 = GENERAL_INFO.loc['WET_SLAB_SIDE']['VALUE']+\
                     GENERAL_INFO.loc['GIRDER_WIDTH']['VALUE'] / 2 + GENERAL_INFO.loc['GIRDER_DIST']['VALUE'] * ((I-1)/2)
    elif I % 2 == 0 and I != 0 and I != IN-1:
        CROSS_DIS0 = GENERAL_INFO.loc['WET_SLAB_SIDE']['VALUE']+GENERAL_INFO.loc['GIRDER_WIDTH']['VALUE'] * (I/2) + \
                     GENERAL_INFO.loc['WET_SLAB_MID']['VALUE'] * (I/2-0.5)
    CROSS_DIS.append(CROSS_DIS0)

# 定义墩顶主梁连接类型
LINK_TYPE = GENERAL_INFO.loc['LINK_TYPE']['VALUE'].split(',')

# 建立T梁上部节点
result.write('''
*NODE    ; Nodes
; iNO, X, Y, Z
''')
NODE = int(1)
N0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
N = []
NP = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN):
      for J in range(JN):
          L = float(TGIRDER_LEN.iloc[J, [TTYPE]])
          D = CROSS_DIS[I]
          if J == 0 and LINK_TYPE[SPAN] == 'CO':
             N0 = {'iNO': NODE, 'X': SPAN_LEN_ADD + L+0.21, 'Y': D, 'Z': 0}
          elif J == JN-1 and LINK_TYPE[SPAN+1] == 'CO':
             N0 = {'iNO': NODE, 'X': SPAN_LEN_ADD + L-0.21, 'Y': D, 'Z': 0}
          else:
              N0 = {'iNO': NODE, 'X': SPAN_LEN_ADD + L, 'Y': D, 'Z': 0}
          N.append(N0)
          NODE = NODE + 1
          result.write('  '+str(N0['iNO'])+ ','+ str(N0['X'])+ ','+ str(N0['Y'])+ ','+ str(N0['Z'])+'\n')
   NP.append(np.array(N).reshape(IN,JN))
   N.clear()
   SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])

# 建立桥面板上层节点
NU0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NU = []
NUP = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN):
      for J in range(JN):
         D = D = CROSS_DIS[I]
         L = float(TGIRDER_LEN.iloc[J,[TTYPE]])
         if J == 0 and LINK_TYPE[SPAN] == 'CO':
             NU0 = {'iNO':NODE, 'X':SPAN_LEN_ADD+L+0.21,'Y':D,'Z':float(GENERAL_INFO.loc['ASPHALT_HEIGHT']['VALUE'])}
         elif J == JN - 1 and LINK_TYPE[SPAN + 1] == 'CO':
             NU0 = {'iNO':NODE, 'X':SPAN_LEN_ADD+L-0.21,'Y':D,'Z':float(GENERAL_INFO.loc['ASPHALT_HEIGHT']['VALUE'])}
         else:
             NU0 = {'iNO':NODE, 'X':SPAN_LEN_ADD+L,'Y':D,'Z':float(GENERAL_INFO.loc['ASPHALT_HEIGHT']['VALUE'])}
         NU.append(NU0)
         NODE = NODE+1
         result.write('  '+str(NU0['iNO'])+','+str(NU0['X'])+','+str(NU0['Y'])+','+str(NU0['Z'])+'\n')
   NUP.append(np.array(NU).reshape(IN,JN))
   NU.clear()
   SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])

# 建立支座上层节点
NSU0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NSU = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for J in [1,JN-2]:
      for I in range(1,IN,2):
         D = CROSS_DIS[I]
         L = float(TGIRDER_LEN.iloc[J,[TTYPE]])
         NSU0 = {'iNO':NODE, 'X':SPAN_LEN_ADD+L,'Y':D,'Z':float(LEVEL_DATA.iloc[SPAN][1])}
         NSU.append(NSU0)
         NODE = NODE+1
         result.write('  '+str(NSU0['iNO'])+','+str(NSU0['X'])+','+str(NSU0['Y'])+','+str(NSU0['Z'])+'\n')
   SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NSUP = np.array(NSU).reshape(SPAN_NOS,2,int((IN-1)/2))

# 建立支座下层节点
NSD0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NSD = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for J in [1,JN-2]:
      for I in range(1,IN,2):
         D = CROSS_DIS[I]
         L = float(TGIRDER_LEN.iloc[J,[TTYPE]])
         NSD0 = {'iNO':NODE, 'X':SPAN_LEN_ADD+L,'Y':D,'Z':float(LEVEL_DATA.iloc[SPAN][2])}
         NSD.append(NSD0)
         NODE = NODE+1
         result.write('  '+str(NSD0['iNO'])+','+str(NSD0['X'])+','+str(NSD0['Y'])+','+str(NSD0['Z'])+'\n')
   SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NSDP = np.array(NSD).reshape(SPAN_NOS,2,int((IN-1)/2))

# 建立盖梁节点
NCAP0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NCAP = []
DCAP = [0,GENERAL_INFO.loc['CAP_TAPERED_LEN']['VALUE'],
      GENERAL_INFO.loc['BRIDGE_WIDTH']['VALUE']-GENERAL_INFO.loc['CAP_TAPERED_LEN']['VALUE'],
      GENERAL_INFO.loc['BRIDGE_WIDTH']['VALUE']]
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS+1):
   for I in range(1,IN,2):
      DCAP0 = CROSS_DIS[I]
      NCAP0 = {'iNO':NODE, 'X':SPAN_LEN_ADD,'Y':DCAP0,
             'Z':float(LEVEL_DATA.iloc[SPAN][3])}
      NCAP.append(NCAP0)
      NODE = NODE+1
      result.write('  '+str(NCAP0['iNO'])+','+str(NCAP0['X'])+','+str(NCAP0['Y'])+','+str(NCAP0['Z'])+'\n')
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      DCAP0 = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE'])
      NCAP0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': DCAP0,
             'Z': float(LEVEL_DATA.iloc[SPAN][3])}
      NCAP.append(NCAP0)
      NODE = NODE + 1
      result.write('  '+str(NCAP0['iNO'])+','+str(NCAP0['X'])+','+str(NCAP0['Y'])+','+str(NCAP0['Z'])+'\n')
   for I in range(len(DCAP)):
      DCAP0= float(DCAP[I])
      NCAP0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': DCAP0,
             'Z': float(LEVEL_DATA.iloc[SPAN][3])}
      NCAP.append(NCAP0)
      NODE = NODE + 1
      result.write('  '+str(NCAP0['iNO'])+','+str(NCAP0['X'])+','+str(NCAP0['Y'])+','+str(NCAP0['Z'])+'\n')
   if SPAN < int(SPAN_NOS):
      SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NCAPP = np.array(NCAP).reshape(SPAN_NOS+1,int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)))

# 定义桥墩挡块上节点
NBLOCK0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NBLOCK = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS+1):
    for J in range(2):
        if J == 0:
            D = 0
        elif J == 1:
            D = float(GENERAL_INFO.loc['BRIDGE_WIDTH']['VALUE'])
        NBLOCK0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': D,
                   'Z': float(LEVEL_DATA.iloc[SPAN][3]) + 1.8}
        NBLOCK.append(NBLOCK0)
        NODE = NODE + 1
        result.write('  '+ str(NBLOCK0['iNO'])+ ','+ str(NBLOCK0['X'])+ ','+ str(NBLOCK0['Y'])+ ','+ str(NBLOCK0['Z'])+'\n')
    if SPAN < int(SPAN_NOS):
        SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NBLOCKP = np.array(NBLOCK).reshape(SPAN_NOS+1,2)

# 建立桥墩节点及冲刷线以上(含)桩基节点
NPIER0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NPIER = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(6):
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE'])
         NPIER0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': D,
                   'Z': float(LEVEL_DATA.iloc[SPAN][J+4])}
         NPIER.append(NPIER0)
         NODE = NODE + 1
         result.write('  '+ str(NPIER0['iNO'])+ ','+ str(NPIER0['X'])+ ','+ str(NPIER0['Y'])+ ','+ str(NPIER0['Z'])+'\n')
   if SPAN < int(SPAN_NOS):
      SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NPIERP = np.array(NPIER).reshape(SPAN_NOS+1,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']),6)

# 建立桩基冲刷线以下节点
NPILE0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NPILE = []
NPILEP = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1):
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE'])
         Z0 = float(NPIERP[SPAN,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1),5]['Z']+\
             SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')][J+1]-SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')][0])
         Z = Z0 if Z0 > float(LEVEL_DATA.iloc[SPAN][10]) else float(LEVEL_DATA.iloc[SPAN][10])
         NPILE0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': D,'Z': Z}
         NPILE.append(NPILE0)
         NODE = NODE + 1
         result.write('  '+ str(NPILE0['iNO'])+ ','+ str(NPILE0['X'])+ ','+ str(NPILE0['Y'])+ ','+ str(NPILE0['Z'])+'\n')
   if SPAN < int(SPAN_NOS):
      SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
   NPILEP.append(np.array(NPILE).reshape(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']),
                                         len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1))
   NPILE.clear()

# 建立底系梁节点
NTIE0 = {'iNO':NODE, 'X':0.0,'Y':0.0,'Z':0.0}
NTIE = []
SPAN_LEN_ADD = float(0)
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*2):
      if I == 0:
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + float(GENERAL_INFO.loc['PILE_DIA']['VALUE'])/2
      elif I == int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*2-1:
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE'])\
             -float(GENERAL_INFO.loc['PILE_DIA']['VALUE']) / 2
      elif I %2 != 0 and 0< I <int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*2-1:
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE']) \
             - float(GENERAL_INFO.loc['PILE_DIA']['VALUE']) / 2
      else:
         D = float(GENERAL_INFO.loc['CAP_CANTI']['VALUE']) + I * float(GENERAL_INFO.loc['COLUMN_DIST']['VALUE']) \
             + float(GENERAL_INFO.loc['PILE_DIA']['VALUE']) / 2
      NTIE0 = {'iNO': NODE, 'X': SPAN_LEN_ADD, 'Y': D,
                'Z': float(LEVEL_DATA.iloc[SPAN][7])}
      NTIE.append(NTIE0)
      NODE = NODE + 1
      result.write('  '+ str(NTIE0['iNO'])+ ','+ str(NTIE0['X'])+ ','+ str(NTIE0['Y'])+ ','+ str(NTIE0['Z'])+'\n')
   if SPAN < int(SPAN_NOS):
      SPAN_LEN_ADD = SPAN_LEN_ADD + float(SPAN_LEN[SPAN])
NTIEP = np.array(NTIE).reshape(SPAN_NOS+1,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*2)

# 定义湿接缝及T梁单元
result.write('''
*ELEMENT    ; Elements
; iEL, TYPE, iMAT, iPRO, iN1, iN2, ANGLE, iSUB,                     ; Frame  Element
; iEL, TYPE, iMAT, iPRO, iN1, iN2, ANGLE, iSUB, EXVAL, EXVAL2, bLMT ; Comp/Tens Truss
; iEL, TYPE, iMAT, iPRO, iN1, iN2, iN3, iN4, iSUB, iWID , LCAXIS    ; Planar Element
; iEL, TYPE, iMAT, iPRO, iN1, iN2, iN3, iN4, iN5, iN6, iN7, iN8     ; Solid  Element
''')
ELEMENT = int(1)
E0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
E = []
EP = []
iPRO = int(0)
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if TTYPE == 0:
       iPRO = int(0)
   elif TTYPE == 1:
       iPRO = 100
   elif TTYPE ==2:
       iPRO = 200
   for I in range(IN):
      for J in range(JN-1):
         if I == 0 or I == IN-1:
            E0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':1,'iPRO':16,
                  'iN1':NP[SPAN][I,J]['iNO'],'iN2':NP[SPAN][I,J+1]['iNO'],'ANGLE':0,'iSUB':0}
         elif I % 2 != 0:
            if J == 0 or J == 1 or J == JN-2 or J == JN-3:
               E0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': iPRO+2,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I, J + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 2:
               E0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': iPRO+3,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I, J + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == JN-4:
               E0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': iPRO+4,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I, J + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            else :
               E0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': iPRO+1,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I, J + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         else:
            E0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': 17,
                  'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I, J + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         E.append(E0)
         ELEMENT = ELEMENT+1
         result.write('  '+str(E0['iEL'])+','+str(E0['TYPE'])+','+str(E0['iMAT'])+','+str(E0['iPRO'])+','+
               str(E0['iN1'])+','+str(E0['iN2'])+','+str(E0['ANGLE'])+','+str(E0['iSUB'])+'\n')
   EP.append(np.array(E).reshape(IN,JN-1))
   E.clear()

# 定义湿接缝及T梁连接单元
EL0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
EL = []
ELP = []
for SPAN in range(SPAN_NOS-1):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if LINK_TYPE[SPAN+1] == 'CO':
       for I in range(IN):
           if I == 0 or I == IN - 1:
               EL0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': 16,
                      'iN1': NP[SPAN][I, JN-1]['iNO'], 'iN2': NP[SPAN+1][I, 0]['iNO'], 'ANGLE': 0, 'iSUB': 0}
           elif I % 2 != 0:
               EL0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': 2,
                      'iN1': NP[SPAN][I, JN-1]['iNO'], 'iN2': NP[SPAN+1][I, 0]['iNO'], 'ANGLE': 0, 'iSUB': 0}
           else:
               EL0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 1, 'iPRO': 9,
                      'iN1': NP[SPAN][I, JN-1]['iNO'], 'iN2': NP[SPAN+1][I, 0]['iNO'], 'ANGLE': 0, 'iSUB': 0}
           EL.append(EL0)
           ELEMENT = ELEMENT + 1
           result.write('  '+ str(EL0['iEL'])+ ','+ str(EL0['TYPE'])+ ','+ str(EL0['iMAT'])+ ','+ str(EL0['iPRO'])+ ','+
                 str(EL0['iN1'])+ ','+ str(EL0['iN2'])+ ','+ str(EL0['ANGLE'])+ ','+ str(EL0['iSUB'])+'\n')
       ELP.append(np.array(EL).reshape(IN))
       EL.clear()


# 定义T梁横向联系单元
EC0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
EC = []
ECP = []
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for J in range(1,JN-1,1):
      for I in range(IN-1):
         if TTYPE ==0:
            if J == 1 or J == JN-2:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 20,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 5,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 2 or J == 3 or J == JN-3 or J == JN-4 :
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 4 or J == 7 or J == 10:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 6,
                         'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I + 1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            else:
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 19,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         elif TTYPE ==1:
            if J == 1 or J == JN-2:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 20,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 5,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 2 or J == 3 or J == JN-3 or J == JN-4 :
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 4 or J == JN-5:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 6,
                         'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I + 1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            else:
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 19,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         elif TTYPE ==2:
            if J == 1 or J == JN-2:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 20,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 5,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 2 or J == 3 or J == JN-3 or J == JN-4 :
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            elif J == 4 or J == JN-5:
               if I == 0 or I == IN-2:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 18,
                        'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
               else:
                  EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 6,
                         'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I + 1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
            else:
               EC0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 2, 'iPRO': 21,
                     'iN1': NP[SPAN][ I, J]['iNO'], 'iN2': NP[SPAN][ I+1, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         EC.append(EC0)
         ELEMENT = ELEMENT+1
         result.write('  '+str(EC0['iEL'])+','+str(EC0['TYPE'])+','+str(EC0['iMAT'])+','+str(EC0['iPRO'])+','+
               str(EC0['iN1'])+','+str(EC0['iN2'])+','+str(EC0['ANGLE'])+','+str(EC0['iSUB'])+'\n')
   ECP.append(np.array(EC).reshape(JN-2,IN-1))
   EC.clear()

# 定义桥面板实体单元
ES0 = {'iEL':ELEMENT,'TYPE':'SOLID','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'iN3':0,'iN4':0,'iN5':0,'iN6':0,'iN7':0,'iN8':0}
ES = []
ESP = []
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN-1):
      for J in range(JN-1):
         ES0 = {'iEL':ELEMENT,'TYPE':'SOLID','iMAT':3,'iPRO':0,
                'iN1':NP[SPAN][ I, J]['iNO'],'iN2':NP[SPAN][ I, J+1]['iNO'],
                'iN3':NP[SPAN][ I+1, J+1]['iNO'],'iN4':NP[SPAN][ I+1, J]['iNO'],
                'iN5':NUP[SPAN][ I, J]['iNO'],'iN6':NUP[SPAN][I, J+1]['iNO'],
                'iN7':NUP[SPAN][ I+1, J+1]['iNO'],'iN8':NUP[SPAN][ I+1, J]['iNO'],}
         ES.append(ES0)
         ELEMENT = ELEMENT+1
         result.write('  '+str(ES0['iEL'])+','+str(ES0['TYPE'])+','+str(ES0['iMAT'])+','+str(ES0['iPRO'])+','+
               str(ES0['iN1'])+','+str(ES0['iN2'])+','+str(ES0['iN3'])+','+str(ES0['iN4'])+','+
               str(ES0['iN5'])+','+str(ES0['iN6'])+','+str(ES0['iN7'])+','+str(ES0['iN8'])+'\n')
   ESP.append(np.array(ES).reshape(IN-1,JN-1))
   ES.clear()

# 定义桥面板实体连接单元
ESL0 = {'iEL':ELEMENT,'TYPE':'SOLID','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'iN3':0,'iN4':0,'iN5':0,'iN6':0,'iN7':0,'iN8':0}
ESL = []
ESLP = []
for SPAN in range(SPAN_NOS-1):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if LINK_TYPE[SPAN+1] == 'CO' or LINK_TYPE[SPAN+1] == 'LINK':
       for I in range(IN-1):
           ESL0 = {'iEL': ELEMENT, 'TYPE': 'SOLID', 'iMAT': 3, 'iPRO': 0,
                  'iN1': NP[SPAN][I, JN - 1]['iNO'], 'iN2': NP[SPAN+1][I, 0]['iNO'],
                  'iN3': NP[SPAN+1][I + 1, 0]['iNO'], 'iN4': NP[SPAN][I + 1, JN - 1]['iNO'],
                  'iN5': NUP[SPAN][I, JN - 1]['iNO'], 'iN6': NUP[SPAN+1][I, 0]['iNO'],
                  'iN7': NUP[SPAN+1][I + 1, 0]['iNO'], 'iN8': NUP[SPAN][I + 1, JN - 1]['iNO'], }
           ESL.append(ESL0)
           ELEMENT = ELEMENT + 1
           result.write('  '+ str(ESL0['iEL'])+ ','+ str(ESL0['TYPE'])+ ','+ str(ESL0['iMAT'])+ ','+ str(ESL0['iPRO'])+ ','+
                 str(ESL0['iN1'])+ ','+ str(ESL0['iN2'])+ ','+ str(ESL0['iN3'])+ ','+ str(ESL0['iN4'])+ ','+
                 str(ESL0['iN5'])+ ','+ str(ESL0['iN6'])+ ','+ str(ESL0['iN7'])+ ','+ str(ESL0['iN8'])+'\n')
       ESLP.append(np.array(ESL).reshape(IN-1))
       ESL.clear()


# 定义桥面铺装板单元
EA0 = {'iEL':ELEMENT,'TYPE':'PLATE','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'iN3':0,'iN4':0,'iSUB':0,'iWID':0}
EA = []
EAP = []
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN-1):
      for J in range(JN-1):
         EA0 = {'iEL':ELEMENT,'TYPE':'PLATE','iMAT':5,'iPRO':1,
                'iN1':NUP[SPAN][ I, J]['iNO'],'iN2':NUP[SPAN][ I, J+1]['iNO'],
                'iN3':NUP[SPAN][ I+1, J+1]['iNO'],'iN4':NUP[SPAN][ I+1, J]['iNO'],
                'iSUB':2,'iWID':0}
         EA.append(EA0)
         ELEMENT = ELEMENT+1
         result.write('  '+str(EA0['iEL'])+','+str(EA0['TYPE'])+','+str(EA0['iMAT'])+','+str(EA0['iPRO'])+','+
               str(EA0['iN1'])+','+str(EA0['iN2'])+','+str(EA0['iN3'])+','+str(EA0['iN4'])+','+
               str(EA0['iSUB'])+','+str(EA0['iWID'])+'\n')
   EAP.append(np.array(EA).reshape(IN-1,JN-1))
   EA.clear()

# 定义桥面铺装连接单元
EAL0 = {'iEL':ELEMENT,'TYPE':'PLATE','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'iN3':0,'iN4':0,'iSUB':0,'iWID':0}
EAL = []
EALP = []
for SPAN in range(SPAN_NOS-1):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if LINK_TYPE[SPAN+1] == 'CO' or LINK_TYPE[SPAN+1] == 'LINK':
       for I in range(IN-1):
           EAL0 = {'iEL': ELEMENT, 'TYPE': 'PLATE', 'iMAT': 5, 'iPRO': 1,
                  'iN1': NUP[SPAN][I, JN-1]['iNO'], 'iN2': NUP[SPAN+1][I, 0]['iNO'],
                  'iN3': NUP[SPAN+1][I + 1, 0]['iNO'], 'iN4': NUP[SPAN][I + 1, JN-1]['iNO'],
                  'iSUB': 2, 'iWID': 0}
           EAL.append(EAL0)
           ELEMENT = ELEMENT + 1
           result.write('  '+ str(EAL0['iEL'])+ ','+ str(EAL0['TYPE'])+ ','+ str(EAL0['iMAT'])+ ','+ str(EAL0['iPRO'])+ ','+
                 str(EAL0['iN1'])+ ','+ str(EAL0['iN2'])+ ','+ str(EAL0['iN3'])+ ','+ str(EAL0['iN4'])+ ','+
                 str(EAL0['iSUB'])+ ','+ str(EAL0['iWID'])+'\n')
       EALP.append(np.array(EAL).reshape(IN-1))
       EAL.clear()

# 定义盖梁单元
ECAP0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
ECAP = []
for SPAN in range(SPAN_NOS+1):
   for I in range(int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-1)):
      if I == 0:
         ECAP0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 13,
                  'iN1': sorted(NCAPP[SPAN], key=lambda i: i['Y'])[I]['iNO'],
                  'iN2': sorted(NCAPP[SPAN], key=lambda i: i['Y'])[I + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      elif I == int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-2):
         ECAP0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 14,
                  'iN1': sorted(NCAPP[SPAN], key=lambda i: i['Y'])[I]['iNO'],
                  'iN2': sorted(NCAPP[SPAN], key=lambda i: i['Y'])[I + 1]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      else:
         ECAP0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':4,'iPRO':12,
                  'iN1':sorted(NCAPP[SPAN],key = lambda i: i['Y'])[I]['iNO'],
                  'iN2':sorted(NCAPP[SPAN],key = lambda i: i['Y'])[I+1]['iNO'],'ANGLE':0,'iSUB':0}
      ELEMENT = ELEMENT+1
      ECAP.append(ECAP0)
      result.write('  '+str(ECAP0['iEL'])+','+str(ECAP0['TYPE'])+','+str(ECAP0['iMAT'])+','+str(ECAP0['iPRO'])+','+
            str(ECAP0['iN1'])+','+str(ECAP0['iN2'])+','+str(ECAP0['ANGLE'])+','+str(ECAP0['iSUB'])+'\n')
ECAPP = np.array(ECAP).reshape(SPAN_NOS+1,int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-1))

# 定义桥墩挡块单元
EBLOCK0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
EBLOCK = []
for SPAN in range(SPAN_NOS+1):
   for I in range(2):
      if I == 0:
         EBLOCK0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 11,
                  'iN1': NCAPP[SPAN,int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-4)]['iNO'],
                  'iN2': NBLOCKP[SPAN,I]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      elif I == 1:
         EBLOCK0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 10,
                  'iN1': NCAPP[SPAN,int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-1)]['iNO'],
                  'iN2': NBLOCKP[SPAN,I]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      ELEMENT = ELEMENT+1
      EBLOCK.append(EBLOCK0)
      result.write('  '+str(EBLOCK0['iEL'])+','+str(EBLOCK0['TYPE'])+','+str(EBLOCK0['iMAT'])+','+str(EBLOCK0['iPRO'])+','+
            str(EBLOCK0['iN1'])+','+str(EBLOCK0['iN2'])+','+str(EBLOCK0['ANGLE'])+','+str(EBLOCK0['iSUB'])+'\n')
EBLOCKP = np.array(EBLOCK).reshape(SPAN_NOS+1,2)


# 定义桥墩单元及冲刷线以上(含)桩基单元
EPIER0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
EPIER = []
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(6):
         if J == 0:
            EPIER0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 7,
                     'iN1': NCAPP[SPAN,int((IN-1)/2)+I]['iNO'],'iN2': NPIERP[SPAN,I,J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         elif J ==1 or J ==2:
            EPIER0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 7,
                      'iN1': NPIERP[SPAN,I,J-1]['iNO'], 'iN2': NPIERP[SPAN, I, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         else:
            EPIER0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 8,
                     'iN1': NPIERP[SPAN,I,J-1]['iNO'],'iN2': NPIERP[SPAN,I,J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         ELEMENT = ELEMENT + 1
         EPIER.append(EPIER0)
         result.write('  '+ str(EPIER0['iEL'])+ ','+ str(EPIER0['TYPE'])+ ','+ str(EPIER0['iMAT'])+ ','+ str(EPIER0['iPRO'])+ ','+
               str(EPIER0['iN1'])+ ','+ str(EPIER0['iN2'])+ ','+ str(EPIER0['ANGLE'])+ ','+ str(EPIER0['iSUB'])+'\n')
EPIERP = np.array(EPIER).reshape(SPAN_NOS+1,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']),6)

# 定义桩基冲刷线以下单元
EPILE0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
EPILE = []
EPILEP = []
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1):
         if J == 0:
            EPILE0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 8,
                      'iN1': NPIERP[SPAN,I,5]['iNO'], 'iN2': NPILEP[SPAN][I, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         else:
            EPILE0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 8,
                      'iN1': NPILEP[SPAN][I, J - 1]['iNO'], 'iN2': NPILEP[SPAN][I, J]['iNO'], 'ANGLE': 0, 'iSUB': 0}
         EPILE.append(EPILE0)
         ELEMENT = ELEMENT + 1
         result.write('  '+ str(EPILE0['iEL'])+ ','+ str(EPILE0['TYPE'])+ ','+ str(EPILE0['iMAT'])+ ','+ str(EPILE0['iPRO'])+ ','+
               str(EPILE0['iN1'])+ ','+ str(EPILE0['iN2'])+ ','+ str(EPILE0['ANGLE'])+ ','+ str(EPILE0['iSUB'])+'\n')
   EPILEP.append(np.array(EPILE).reshape(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']),
                                         len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1))
   EPILE.clear()

# 定义底系梁单元
ETIE0 = {'iEL':ELEMENT,'TYPE':'BEAM','iMAT':0,'iPRO':0,'iN1':0,'iN2':0,'ANGLE':0,'iSUB':0}
ETIE = []
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*3):
      if (I+3) %3 == 0:
         ETIE0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 15,
                  'iN1': NPIERP[SPAN,I,3]['iNO'], 'iN2': NTIEP[SPAN,I]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      elif (I+1) %3 == 0:
         ETIE0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 15,
                  'iN1': NTIEP[SPAN,I-1]['iNO'], 'iN2':NPIERP[SPAN,(I+1) % 3,3]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      else:
         ETIE0 = {'iEL': ELEMENT, 'TYPE': 'BEAM', 'iMAT': 4, 'iPRO': 15,
                  'iN1': NTIEP[SPAN,I-1]['iNO'], 'iN2': NTIEP[SPAN,I]['iNO'], 'ANGLE': 0, 'iSUB': 0}
      ETIE.append(ETIE0)
      ELEMENT = ELEMENT + 1
      result.write('  '+str(ETIE0['iEL'])+ ','+ str(ETIE0['TYPE'])+ ','+ str(ETIE0['iMAT'])+ ','+ str(ETIE0['iPRO'])+ ','+
            str(ETIE0['iN1'])+ ','+ str(ETIE0['iN2'])+ ','+ str(ETIE0['ANGLE'])+ ','+ str(ETIE0['iSUB'])+'\n')
ETIEP = np.array(ETIE).reshape(SPAN_NOS+1,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*3)

# 定义结构组
result.write('''
*GROUP    ; Group
; NAME, NODE_LIST, ELEM_LIST, PLANE_TYPE
''')

# 定义T梁结构组
result.write('T GIRDER , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      if SPAN == SPAN_NOS-1 and I == IN-2:
         result.write(str(EP[SPAN][I,0]['iEL'])+' to '+str(EP[SPAN][I,JN-2]['iEL'])+', 0'+'\n')
      else:
         result.write(str(EP[SPAN][I,0]['iEL'])+' to '+str(EP[SPAN][I,JN-2]['iEL'])+' \\'+'\n')

# 定义湿接缝结构组
result.write('WET SLAB , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(0,IN,2):
      if SPAN == SPAN_NOS-1 and I == IN-1:
         result.write(str(EP[SPAN][I,0]['iEL'])+' to '+str(EP[SPAN][I,JN-2]['iEL'])+', 0'+'\n')
      else:
         result.write(str(EP[SPAN][I,0]['iEL'])+' to '+str(EP[SPAN][I,JN-2]['iEL'])+' \\'+'\n')

# 定义端横隔板结构组
result.write('END DIAPHRAGMS , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if SPAN == int(SPAN_NOS-1):
      result.write(str(ECP[SPAN][ 0, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 0, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ JN-3,0]['iEL'])+ ' to '+ str(ECP[SPAN][ JN-3, IN - 2]['iEL'])+ ', 0'+'\n')
   else:
      result.write(str(ECP[SPAN][ 0, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 0, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ JN-3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ JN-3, IN - 2]['iEL'])+ ' \\'+'\n')

# 定义中横隔板结构组
result.write('MID DIAPHRAGMS , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN,TTYPE = SPAN_JN_TYPE(SPAN)
   if TTYPE == 0:
      if SPAN == int(SPAN_NOS-1):
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 6, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 6, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 9, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 9, IN - 2]['iEL'])+ ',0'+'\n')
      else:
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 6, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 6, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 9, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 9, IN - 2]['iEL'])+ ' \\'+'\n')
   elif TTYPE == 1:
      if SPAN == int(SPAN_NOS - 1):
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 7, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 7, IN - 2]['iEL'])+ ',0'+'\n')
      else:
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 7, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 7, IN - 2]['iEL'])+ ' \\'+'\n')
   elif TTYPE == 2:
      if SPAN == int(SPAN_NOS - 1):
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 7, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 7, IN - 2]['iEL'])+ ',0'+'\n')
      else:
         result.write(str(ECP[SPAN][ 3, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 3, IN - 2]['iEL'])+ ' \\'+'\n')
         result.write(str(ECP[SPAN][ 7, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 7, IN - 2]['iEL'])+ ' \\'+'\n')

# 定义虚拟横梁结构组
result.write('TG_WJ CONNECTION , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   if TTYPE == 0:
      result.write(str(ECP[SPAN][ 1, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 1, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 2, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 2, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 4, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 4, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 5, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 5, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 7, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 7, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 8, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 8, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 10, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 10, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 11, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 11, IN - 2]['iEL'])+ ' \\'+'\n')
   elif TTYPE == 1:
      result.write(str(ECP[SPAN][ 1, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 1, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 2, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 2, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 4, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 4, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 5, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 5, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 6, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 6, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 8, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 8, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 9, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 9, IN - 2]['iEL'])+ ' \\'+'\n')
   elif TTYPE == 2:
      result.write(str(ECP[SPAN][ 1, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 1, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 2, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 2, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 4, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 4, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 5, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 5, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 6, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 6, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 8, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 8, IN - 2]['iEL'])+ ' \\'+'\n')
      result.write(str(ECP[SPAN][ 9, 0]['iEL'])+ ' to '+ str(ECP[SPAN][ 9, IN - 2]['iEL'])+ ' \\'+'\n')
result.write(',0'+'\n')

# 定义现浇段结构组
result.write('CAST_IN_SITU , , '+' \\'+'\n')
for LINK in range(len(ELP)):
    result.write(str(ELP[LINK][0]['iEL'])+ ' to '+ str(ELP[LINK][IN-1]['iEL'])+ ' \\'+'\n')
result.write(',0'+'\n')

# 定义桥面板结构组
result.write('DECK SLAB , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN-1):
      result.write(str(ESP[SPAN][ I, 0]['iEL'])+ ' to '+ str(ESP[SPAN][ I, JN - 2]['iEL'])+ ' \\'+'\n')
for LINK in range(len(ESLP)):
    result.write(str(ESLP[LINK][0]['iEL'])+ ' to '+ str(ESLP[LINK][IN-2]['iEL'])+ ' \\'+'\n')
result.write(',0'+'\n')

# 定义沥青铺装结构组
result.write('ASPHALT , , '+' \\'+'\n')
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(IN-1):
      result.write(str(EAP[SPAN][ I, 0]['iEL'])+ ' to '+ str(EAP[SPAN][I, JN - 2]['iEL'])+ ' \\'+'\n')
for LINK in range(len(EALP)):
    result.write(str(EALP[LINK][0]['iEL'])+ ' to '+ str(EALP[LINK][IN-2]['iEL'])+ ' \\'+'\n')
result.write(',0'+'\n')

# 定义支座结构组
result.write('BEARINGS , '+' \\'+'\n')
# 建立支座上层节点组
for SPAN in range(SPAN_NOS):
   result.write(str(NSUP[SPAN, 0, 0]['iNO'])+ ' to '+ str(NSUP[SPAN, 0, int((IN-1)/2)-1]['iNO'])+ ' \\'+'\n')
   result.write(str(NSUP[SPAN, 1, 0]['iNO'])+ ' to '+ str(NSUP[SPAN, 1, int((IN - 1) / 2) - 1]['iNO'])+ ' \\'+'\n')

# 建立支座下层节点组
for SPAN in range(SPAN_NOS):
   result.write(str(NSDP[SPAN, 0, 0]['iNO'])+ ' to '+ str(NSDP[SPAN, 0, int((IN-1)/2)-1]['iNO'])+ ' \\'+'\n')
   result.write(str(NSDP[SPAN, 1, 0]['iNO'])+ ' to '+ str(NSDP[SPAN, 1, int((IN - 1) / 2) - 1]['iNO'])+ ' \\'+'\n')
result.write(', , 0'+'\n')


# 定义下部结构组
result.write('SUBSTRUCTURE , , '+' \\'+'\n')
# 定义盖梁下部结构组
for SPAN in range(SPAN_NOS+1):
   result.write(str(ECAPP[SPAN, 0]['iEL'])+ ' to '+
         str(ECAPP[SPAN,int((IN-1)/2+GENERAL_INFO.loc['COLUMN_NOS']['VALUE']+len(DCAP)-1)-1]['iEL'])+ ' \\'+'\n')

# 定义桥墩单元及冲刷线以上(含)桩基单元下部结构组
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      result.write(str(EPIERP[SPAN, I,0]['iEL'])+ ' to '+str(EPIERP[SPAN, I,5]['iEL'])+ ' \\'+'\n')

# 定义桩基冲刷线以下单元下部结构组
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      result.write(str(EPILEP[SPAN][I, 0]['iEL'])+ ' to '+
            str(EPILEP[SPAN][I,len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-2]['iEL'])+ ' \\'+'\n')

# 定义底系梁单元下部结构组
for SPAN in range(SPAN_NOS+1):
   result.write(str(ETIEP[SPAN, 0]['iEL'])+ ' to '+
            str(ETIEP[SPAN,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1)*3-1]['iEL'])+ ' \\'+'\n')
result.write(',0'+'\n')

# 定义边界组
result.write('''
*BNDR-GROUP    ; Boundary Group
; NAME, AUTOTYPE
 T GIRDER_RIGID LINKS, 0
 BEARINGS, 0
 SOIL SPRINGS, 0
 PILE PIN_SUPPORTS, 0
''')

# 定义荷载组
result.write('''
*LOAD-GROUP    ; Load Group
; NAME
 SELF_WEIGHT
 PARAPET
 SERVICES
 ASPHALT
 T_36
 T_20
 C&S_TEM
 FLOOD_LOAD
 WIND_T_WITH_L
 WIND_T_WITHOUT_L
 WIND_V_WITH_L
 WIND_V_WITHOUT_L
 WIND_L_MAX
 PTF
 TRACTION
 SKIDDING
''')

# 定义荷载工况
result.write('''
*STLDCASE    ; Static Load Cases
; LCNAME, LCTYPE, DESC
   SELF_WEIGHT, CS,
   PARAPET, CS,
   SERVICES, D,
   ASPHALT, D ,
   T_36 , T ,
   T_20 , T ,
   C&S_TEM, USER,
   FLOOD_LOAD, SF,
   WIND_T_WITH_L, W ,
   WIND_T_WITHOUT_L, W ,
   WIND_V_WITH_L, W ,
   WIND_V_WITHOUT_L, W ,
   WIND_L_MAX, W ,
   PTF , CS,   
''')

# 定义制动力荷载工况
for LANE in range(GENERAL_INFO.loc['LANE_NOS']['VALUE']):
   result.write('  TRACTION_'+str(LANE+1)+',BRK,'+'\n')

# 定义侧向滑移荷载工况
for SPAN in range(SPAN_NOS+1):
   result.write('  SKIDDING_'+str(LEVEL_DATA.iloc[SPAN][0])+',CT,'+'\n')


# 定义边界条件
# 定义T梁与支座上节点刚性连接
result.write('''
*RIGIDLINK    ; Rigid Link
; M-NODE, DOF, S-NODE LIST, GROUP
''')
RLINK = {'M-NODE':0, 'DOF':'111111', 'S-NODE LIST':0, 'GROUP':'T GIRDER_RIGID LINKS'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for J in [1,JN-2]:
      for I in range(1,IN,2):
         RLINK = {'M-NODE':NP[SPAN][I,J]['iNO'], 'DOF':'111111',
                  'S-NODE LIST':NSUP[SPAN,0 if J == 1 else 1 ,int((I-1)/2)]['iNO'], 'GROUP':'T GIRDER_RIGID LINKS'}
         result.write('  '+str(RLINK['M-NODE'])+','+RLINK['DOF']+','+str(RLINK['S-NODE LIST'])+','+RLINK['GROUP']+'\n')

# 定义支座下节点与盖梁刚性连接
for SPAN in range(SPAN_NOS+1):
   for I in range(1,IN,2):
       if SPAN == 0:
           RLINK = {'M-NODE':NCAPP[SPAN,int((I-1)/2)]['iNO'], 'DOF':'111111',
                    'S-NODE LIST':NSDP[SPAN,0,int((I-1)/2)]['iNO'], 'GROUP':'BEARINGS'}
           result.write('  '+ str(RLINK['M-NODE'])+ ','+ str(RLINK['DOF'])+ ','+ str(RLINK['S-NODE LIST'])+ ','+ str(RLINK['GROUP'])+'\n')
       elif SPAN == SPAN_NOS:
           RLINK = {'M-NODE': NCAPP[SPAN, int((I - 1) / 2)]['iNO'], 'DOF': '111111',
                    'S-NODE LIST': NSDP[SPAN-1, 1, int((I - 1) / 2)]['iNO'], 'GROUP': 'BEARINGS'}
           result.write('  '+ str(RLINK['M-NODE'])+ ','+ str(RLINK['DOF'])+ ','+ str(RLINK['S-NODE LIST'])+ ','+ str(RLINK['GROUP'])+'\n')
       else:
           RLINK = {'M-NODE': NCAPP[SPAN, int((I - 1) / 2)]['iNO'], 'DOF': '111111',
                    'S-NODE LIST': NSDP[SPAN-1, 1, int((I - 1) / 2)]['iNO'],'GROUP': 'BEARINGS'}
           RLINK1 = {'M-NODE': NCAPP[SPAN, int((I - 1) / 2)]['iNO'], 'DOF': '111111',
                     'S-NODE LIST': NSDP[SPAN, 0, int((I - 1) / 2)]['iNO'], 'GROUP': 'BEARINGS'}
           result.write('  '+ str(RLINK['M-NODE'])+ ','+ str(RLINK['DOF'])+ ','+ str(RLINK['S-NODE LIST'])+ ' '+str(RLINK1['S-NODE LIST'])
                 +','+ str(RLINK['GROUP'])+'\n')

# 定义支座弹性连接
result.write('''
*ELASTICLINK    ; Elastic Link
; iNO, iNODE1, iNODE2, LINK, ANGLE, R_SDx, R_SDy, R_SDz, R_SRx, R_SRy, R_SRz, SDx, SDy, SDz, SRx, SRy, SRz ... 
;                      bSHEAR, DRy, DRz, GROUP                                                           ; GEN
; iNO, iNODE1, iNODE2, LINK, ANGLE, bSHEAR, DRy, DRz, GROUP                                              ; RIGID,SADDLE
; iNO, iNODE1, iNODE2, LINK, ANGLE, SDx, bSHEAR, DRy, DRz, GROUP                                         ; TENS,COMP
; iNO, iNODE1, iNODE2, LINK, ANGLE, DIR, FUNCTION, bSHEAR, DRENDI, GROUP                                 ; MULTI LINEAR
''')
ELINK_NOS = int(1)
ELINK = {'iNO':ELINK_NOS, 'iNODE1':0, 'iNODE2':0, 'LINK':'GEN', 'ANGLE':0,
         'R_SDx':'NO', 'R_SDy':'NO', 'R_SDz':'NO', 'R_SRx':'NO', 'R_SRy':'NO', 'R_SRz':'NO',
         'SDx':782005, 'SDy':2218, 'SDz':2218, 'SRx':1, 'SRy':1, 'SRz':1 ,
         'bSHEAR':'NO', 'DRy':0.5, 'DRz':0.5, 'GROUP':'BEARINGS'}
for SPAN in range(SPAN_NOS):
   for J in [0,1]:
      for I in range(1,IN,2):
          ELINK = {'iNO': ELINK_NOS, 'iNODE1': NSUP[SPAN,J ,int((I-1)/2)]['iNO'],
                   'iNODE2': NSDP[SPAN,J ,int((I-1)/2)]['iNO'], 'LINK': 'GEN', 'ANGLE': 0,
                   'R_SDx': 'NO', 'R_SDy': 'NO', 'R_SDz': 'NO', 'R_SRx': 'NO', 'R_SRy': 'NO', 'R_SRz': 'NO',
                   'SDx': 782005, 'SDy': 2218, 'SDz': 2218, 'SRx': 1, 'SRy': 1, 'SRz': 1,
                   'bSHEAR': 'NO', 'DRy': 0.5, 'DRz': 0.5, 'GROUP': 'BEARINGS'}
          result.write('  '+str(ELINK['iNO'])+','+str(ELINK['iNODE1'])+','+str(ELINK['iNODE2'])+','+str(ELINK['LINK'])+','+str(ELINK['ANGLE'])+','+
                str(ELINK['R_SDx'])+','+str(ELINK['R_SDy'])+','+str(ELINK['R_SDz'])+','+str(ELINK['R_SRx'])+','+str(ELINK['R_SRy'])+','+
                str(ELINK['R_SRz'])+','+str(ELINK['SDx'])+','+str(ELINK['SDy'])+','+str(ELINK['SDz'])+','+str(ELINK['SRx'])+','+
                str(ELINK['SRy'])+','+str(ELINK['SRz'])+','+str(ELINK['bSHEAR'])+','+str(ELINK['DRy'])+','+str(ELINK['DRz'])+','+str(ELINK['GROUP'])+'\n')
          ELINK_NOS = ELINK_NOS + 1

# 定义桩基土弹簧
result.write('''
*SPRING    ; Point Spring Supports
; NODE_LIST, Type, F_SDx, F_SDy, F_SDz, F_SRx, F_SRy, F_SRz, SDx, SDy, SDz, SRx, SRy, SRz ...
;                  DAMPING, Cx, Cy, Cz, CRx, CRy, CRz, GROUP, [DATA1]                                ; LINEAR
; NODE_LIST, Type, Direction, Vx, Vy, Vz, Stiffness, GROUP, [DATA1]                                  ; COMP, TENS
; NODE_LIST, Type, Direction, Vx, Vy, Vz, FUNCTION, GROUP, [DATA1]                                   ; MULTI
''')
SPRING = {'NODE_LIST':0, 'Type':'LINEAR', 'F_SDx':'NO', 'F_SDy':'NO', 'F_SDz':'NO',
              'F_SRx':'NO', 'F_SRy':'NO', 'F_SRz':'NO', 'SDx':0, 'SDy':0, 'SDz':0, 'SRx':0, 'SRy':0, 'SRz':0,
              'DAMPING':'NO','Cx':0, 'Cy':0, 'Cz':0, 'CRx':0, 'CRy':0, 'CRz':0, 'GROUP':'SOIL SPRINGS',
              'DATA1':'0, 0, 0, 0, 0'}
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1):
         if J == 0:
            SPRING = {'NODE_LIST': NPIERP[SPAN,int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE']-1),5]['iNO'],
                          'Type': 'LINEAR','F_SDx': 'NO', 'F_SDy': 'NO', 'F_SDz': 'NO',
                          'F_SRx': 'NO', 'F_SRy': 'NO', 'F_SRz': 'NO',
                          'SDx': SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'SPRING')][J],
                          'SDy': SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'SPRING')][J], 'SDz': 0,
                          'SRx': 0, 'SRy': 0,'SRz': 0,'DAMPING': 'NO', 'Cx': 0, 'Cy': 0, 'Cz': 0,
                          'CRx': 0, 'CRy': 0, 'CRz': 0,'GROUP': 'SOIL SPRINGS','DATA1': '0, 0, 0, 0, 0'}
         else:
            SPRING = {'NODE_LIST': NPILEP[SPAN][I,J-1]['iNO'],
                          'Type': 'LINEAR', 'F_SDx': 'NO', 'F_SDy': 'NO', 'F_SDz': 'NO',
                          'F_SRx': 'NO', 'F_SRy': 'NO', 'F_SRz': 'NO',
                          'SDx': SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0], 'SPRING')][J],
                          'SDy': SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0], 'SPRING')][J], 'SDz': 0,
                          'SRx': 0, 'SRy': 0, 'SRz': 0, 'DAMPING': 'NO', 'Cx': 0, 'Cy': 0, 'Cz': 0,
                          'CRx': 0, 'CRy': 0, 'CRz': 0, 'GROUP': 'SOIL SPRINGS', 'DATA1': '0, 0, 0, 0, 0'}
         result.write('  '+ str(SPRING['NODE_LIST'])+ ','+ str(SPRING['Type'])+ ','+ str(SPRING['F_SDx'])+ ','+ str(SPRING['F_SDy'])+ ','+
               str(SPRING['F_SDz'])+ ','+ str(SPRING['F_SRx'])+ ','+ str(SPRING['F_SRy'])+ ','+ str(SPRING['F_SRz'])+ ','+
               str(SPRING['SDx'])+ ','+ str(SPRING['SDy'])+ ','+ str(SPRING['SDz'])+ ','+str(SPRING['SRx'])+ ','+ str(SPRING['SRy'])+ ','+
               str(SPRING['SRz'])+ ','+ str(SPRING['DAMPING'])+ ','+ str(SPRING['Cx'])+ ','+ str(SPRING['Cy'])+ ','+ str(SPRING['Cz'])+ ','+
               str(SPRING['CRx'])+ ','+ str(SPRING['CRy']) + ','+ str(SPRING['CRz'])+ ','+ str(SPRING['GROUP'])+ ','+ str(SPRING['DATA1'])+'\n')

# 定义桩底支撑
result.write('''
*CONSTRAINT    ; Supports
; NODE_LIST, CONST(Dx,Dy,Dz,Rx,Ry,Rz), GROUP
''')
SUPPORT = {'NODE_LIST':0, 'CONST(Dx,Dy,Dz,Rx,Ry,Rz)':'111000', 'GROUP':'PILE PIN_SUPPORTS'}
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      J = len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-1
      SUPPORT = {'NODE_LIST': NPILEP[SPAN][I,J-1]['iNO'], 'CONST(Dx,Dy,Dz,Rx,Ry,Rz)': '111000',
                 'GROUP': 'PILE PIN_SUPPORTS'}
      result.write('  '+ str(SUPPORT['NODE_LIST'])+ ','+ str(SUPPORT['CONST(Dx,Dy,Dz,Rx,Ry,Rz)'])+ ','+ str(SUPPORT['GROUP'])+'\n')


# 定义自重
result.write('''
*USE-STLD, SELF_WEIGHT

*SELFWEIGHT    ; Self Weight
; X, Y, Z, GROUP
0, 0, -1, SELF_WEIGHT
''')

# 定义挡墙荷载
result.write('''
*USE-STLD, PARAPET

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
PARAPET = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GZ', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'PARAPET','ADDITIONAL':'NO, 0, 0, NO,'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in [0,IN-1]:
      for J in range(JN-1):
         PARAPET = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GZ',
                    'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                    'D1': 0, 'P1':LOAD_CASE.loc['PARAPET']['VALUE'], 'D2': 1, 'P2': LOAD_CASE.loc['PARAPET']['VALUE'],
                    'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,'GROUP': 'PARAPET', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+str(PARAPET['ELEM_LIST'])+','+str(PARAPET['CMD'])+','+str(PARAPET['TYPE'])+','+str(PARAPET['DIR'])+','+
               str(PARAPET['bPROJ'])+','+str(PARAPET['bECCEN'])+','+str(PARAPET['ECCDIR'])+','+str(PARAPET['D1'])+','+str(PARAPET['P1'])+','+
               str(PARAPET['D2'])+','+str(PARAPET['P2'])+','+str(PARAPET['D3'])+','+str(PARAPET['P3'])+','+str(PARAPET['D4'])+','+str(PARAPET['P4'])
               +','+str(PARAPET['GROUP'])+','+str(PARAPET['ADDITIONAL'])+'\n')

# 定义管道附属荷载
result.write('''
*USE-STLD, SERVICES

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
SERVICES = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GZ', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'SERVICES','ADDITIONAL':'NO, 0, 0, NO,'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in [0,IN-1]:
      for J in range(JN-1):
         SERVICES = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GZ',
                    'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                    'D1': 0, 'P1':LOAD_CASE.loc['SERVICES']['VALUE'], 'D2': 1, 'P2': LOAD_CASE.loc['SERVICES']['VALUE'],
                    'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,'GROUP': 'SERVICES', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+str(SERVICES['ELEM_LIST'])+','+str(SERVICES['CMD'])+','+str(SERVICES['TYPE'])+','+str(SERVICES['DIR'])+','+
               str(SERVICES['bPROJ'])+','+str(SERVICES['bECCEN'])+','+str(SERVICES['ECCDIR'])+','+str(SERVICES['D1'])+','+
               str(SERVICES['P1'])+','+str(SERVICES['D2'])+','+str(SERVICES['P2'])+','+str(SERVICES['D3'])+','+str(SERVICES['P3'])+','+
               str(SERVICES['D4'])+','+str(SERVICES['P4'])+','+str(SERVICES['GROUP'])+','+str(SERVICES['ADDITIONAL'])+'\n')

# 定义沥青铺装荷载
result.write('''
*USE-STLD, ASPHALT

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
ASPHALT = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GZ', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'ASPHALT','ADDITIONAL':'NO, 0, 0, NO,'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         ASPHALT = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GZ',
                    'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                    'D1': 0, 'P1':LOAD_CASE.loc['ASPHALT']['VALUE'], 'D2': 1, 'P2': LOAD_CASE.loc['ASPHALT']['VALUE'],
                    'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,'GROUP': 'ASPHALT', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+str(ASPHALT['ELEM_LIST'])+','+str(ASPHALT['CMD'])+','+str(ASPHALT['TYPE'])+','+str(ASPHALT['DIR'])+','+
               str(ASPHALT['bPROJ'])+','+str(ASPHALT['bECCEN'])+','+str(ASPHALT['ECCDIR'])+','+str(ASPHALT['D1'])+','+
               str(ASPHALT['P1'])+','+str(ASPHALT['D2'])+','+str(ASPHALT['P2'])+','+str(ASPHALT['D3'])+','+str(ASPHALT['P3'])+','+
               str(ASPHALT['D4'])+','+str(ASPHALT['P4'])+','+str(ASPHALT['GROUP'])+','+str(ASPHALT['ADDITIONAL'])+'\n')

# 定义升温温度荷载
result.write('''
*USE-STLD, T_36

*ELTEMPER    ; Element Temperatures
; ELEM_LIST, TEMPER, GROUP
''')
for I in range(EAP[SPAN_NOS-1][IN-2,JN-2]['iEL']):
   result.write(str(I+1)+','+str(LOAD_CASE.loc['T_36']['VALUE'])+','+'T_36'+'\n')

# 定义降温温度荷载
result.write('''
*USE-STLD, T_20

*ELTEMPER    ; Element Temperatures
; ELEM_LIST, TEMPER, GROUP
''')
for I in range(EAP[SPAN_NOS-1][IN-2,JN-2]['iEL']):
   result.write(str(I+1)+','+str(LOAD_CASE.loc['T_20']['VALUE'])+','+'T_20'+'\n')

# 定义收缩徐变等效降温荷载
result.write('''
*USE-STLD, C&S_TEM

*ELTEMPER    ; Element Temperatures
; ELEM_LIST, TEMPER, GROUP
''')
for I in range(EAP[SPAN_NOS-1][IN-2,JN-2]['iEL']):
   result.write(str(I+1)+','+str(LOAD_CASE.loc['C&S_TEM']['VALUE'])+','+'C&S_TEM'+'\n')

# 定义流水压力荷载
result.write('''
*USE-STLD, FLOOD_LOAD

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
FLOOD_LOAD_X = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GX', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'FLOOD_LOAD','ADDITIONAL':'NO, 0, 0, NO,'}
FLOOD_LOAD_Y = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GY', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'FLOOD_LOAD','ADDITIONAL':'NO, 0, 0, NO,'}
P1_X = float(0)
P0_X = float(0)
P1_Y = float(0)
P0_Y = float(0)
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(2,6,1):
         P1_X = LOAD_CASE.loc['FLOOD_LOAD_X']['VALUE']*\
              (NPIERP[SPAN,I,J-1]['Z']-NPIERP[SPAN,I,5]['Z'])/(NPIERP[SPAN,I,1]['Z']-NPIERP[SPAN,I,5]['Z'])
         P2_X = LOAD_CASE.loc['FLOOD_LOAD_X']['VALUE'] * \
              (NPIERP[SPAN, I, J]['Z'] - NPIERP[SPAN, I, 5]['Z']) / (NPIERP[SPAN, I, 1]['Z'] - NPIERP[SPAN, I, 5]['Z'])
         P1_Y = LOAD_CASE.loc['FLOOD_LOAD_Y']['VALUE'] * (NPIERP[SPAN, I, J - 1]['Z'] - NPIERP[SPAN, I, 5]['Z'])\
                / (NPIERP[SPAN, I, 1]['Z'] - NPIERP[SPAN, I, 5]['Z'])
         P2_Y = LOAD_CASE.loc['FLOOD_LOAD_Y']['VALUE'] * (NPIERP[SPAN, I, J]['Z'] - NPIERP[SPAN, I, 5]['Z']) \
                / (NPIERP[SPAN, I, 1]['Z'] - NPIERP[SPAN, I, 5]['Z'])
         FLOOD_LOAD_X = {'ELEM_LIST': EPIERP[SPAN,I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GX',
                       'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,','D1': 0, 'P1':P1_X,'D2': 1, 'P2': P2_X,
                       'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,'GROUP': 'FLOOD_LOAD', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         FLOOD_LOAD_Y = {'ELEM_LIST': EPIERP[SPAN, I, J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GY',
                         'bPROJ': 'NO', 'bECCEN': 'NO', 'ECCDIR': 'aDir[1], , ,', 'D1': 0,'P1': P1_Y,'D2':1,'P2': P2_Y,
                         'D3': 0, 'P3': 0, 'D4': 0, 'P4': 0, 'GROUP': 'FLOOD_LOAD', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(FLOOD_LOAD_X['ELEM_LIST'])+ ','+ str(FLOOD_LOAD_X['CMD'])+ ','+ str(FLOOD_LOAD_X['TYPE'])+ ','+
               str(FLOOD_LOAD_X['DIR'])+ ','+ str(FLOOD_LOAD_X['bPROJ'])+ ','+ str(FLOOD_LOAD_X['bECCEN'])+ ','+
               str(FLOOD_LOAD_X['ECCDIR'])+ ','+ str(FLOOD_LOAD_X['D1'])+ ','+ str(FLOOD_LOAD_X['P1'])+ ','+ str(FLOOD_LOAD_X['D2'])+ ','+
               str(FLOOD_LOAD_X['P2'])+ ','+ str(FLOOD_LOAD_X['D3'])+ ','+ str(FLOOD_LOAD_X['P3'])+ ','+ str(FLOOD_LOAD_X['D4'])+ ','+
               str(FLOOD_LOAD_X['P4'])+ ','+ str(FLOOD_LOAD_X['GROUP'])+ ','+ str(FLOOD_LOAD_X['ADDITIONAL'])+'\n')
         result.write('  '+ str(FLOOD_LOAD_Y['ELEM_LIST'])+ ','+ str(FLOOD_LOAD_Y['CMD'])+ ','+ str(FLOOD_LOAD_Y['TYPE'])+ ','+
               str(FLOOD_LOAD_Y['DIR'])+ ','+ str(FLOOD_LOAD_Y['bPROJ'])+ ','+ str(FLOOD_LOAD_Y['bECCEN'])+ ','+
               str(FLOOD_LOAD_Y['ECCDIR'])+ ','+ str(FLOOD_LOAD_Y['D1'])+ ','+ str(FLOOD_LOAD_Y['P1'])+ ','+ str(FLOOD_LOAD_Y['D2'])+ ','+
               str(FLOOD_LOAD_Y['P2'])+ ','+ str(FLOOD_LOAD_Y['D3'])+ ','+ str(FLOOD_LOAD_Y['P3'])+ ','+ str(FLOOD_LOAD_Y['D4'])+ ','+
               str(FLOOD_LOAD_Y['P4'])+ ','+ str(FLOOD_LOAD_Y['GROUP'])+ ','+ str(FLOOD_LOAD_Y['ADDITIONAL'])+'\n')

# 定义流水漂浮物撞击荷载
result.write('''
*CONLOAD    ; Nodal Loads
; NODE_LIST, FX, FY, FZ, MX, MY, MZ, GROUP
''')
FLOOD_DEBRIS = {'NODE_LIST':0, 'FX':0, 'FY':0,'FZ':0,'MX':0,'MY':0,'MZ':0,'GROUP':'FLOOD_LOAD'}
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      FLOOD_DEBRIS = {'NODE_LIST': NPIERP[SPAN,I,1]['iNO'], 'FX': LOAD_CASE.loc['FLOOD_DEBRIS_X']['VALUE'],
                      'FY': LOAD_CASE.loc['FLOOD_DEBRIS_Y']['VALUE'], 'FZ': 0,
                        'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'FLOOD_LOAD'}
      result.write('  '+ str(FLOOD_DEBRIS['NODE_LIST'])+ ','+ str(FLOOD_DEBRIS['FX'])+ ','+ str(FLOOD_DEBRIS['FY'])+ ','+str(FLOOD_DEBRIS['FZ'])+
            ','+ str(FLOOD_DEBRIS['MX'])+ ','+ str(FLOOD_DEBRIS['MY'])+ ','+ str(FLOOD_DEBRIS['MY'])+ ','+ str(FLOOD_DEBRIS['GROUP'])+'\n')

# 定义横向有车风荷载
result.write('''
*USE-STLD, WIND_T_WITH_L

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
WIND_T_WITH_L = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GY', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'WIND_T_WITH_L','ADDITIONAL':'NO, 0, 0, NO,'}
# 横向有车风荷载_上部结构
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         WIND_T_WITH_L = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GY',
                          'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                          'D1': 0, 'P1':LOAD_CASE.loc['WIND_T_WITH_L_SUPER']['VALUE'], 'D2': 1,
                          'P2': LOAD_CASE.loc['WIND_T_WITH_L_SUPER']['VALUE'],'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,
                          'GROUP': 'WIND_T_WITH_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_T_WITH_L['ELEM_LIST'])+','+ str(WIND_T_WITH_L['CMD'])+','+ str(WIND_T_WITH_L['TYPE'])+','+
               str(WIND_T_WITH_L['DIR'])+','+str(WIND_T_WITH_L['bPROJ'])+','+str(WIND_T_WITH_L['bECCEN'])+','+
               str(WIND_T_WITH_L['ECCDIR'])+','+str(WIND_T_WITH_L['D1'])+','+str(WIND_T_WITH_L['P1'])+','+str(WIND_T_WITH_L['D2'])+','+
               str(WIND_T_WITH_L['P2'])+','+str(WIND_T_WITH_L['D3'])+','+str(WIND_T_WITH_L['P3'])+','+str(WIND_T_WITH_L['D4'])+','+
               str(WIND_T_WITH_L['P4'])+','+str(WIND_T_WITH_L['GROUP'])+','+str(WIND_T_WITH_L['ADDITIONAL'])+'\n')
# 横向有车风荷载_下部结构
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(0,3,1):
         WIND_T_WITH_L = {'ELEM_LIST': EPIERP[SPAN,I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GY',
                          'bPROJ': 'NO', 'bECCEN': 'NO', 'ECCDIR': 'aDir[1], , ,',
                          'D1': 0, 'P1': LOAD_CASE.loc['WIND_T_WITH_L_SUB']['VALUE'], 'D2': 1,
                          'P2': LOAD_CASE.loc['WIND_T_WITH_L_SUB']['VALUE'], 'D3': 0, 'P3': 0, 'D4': 0, 'P4': 0,
                          'GROUP': 'WIND_T_WITH_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_T_WITH_L['ELEM_LIST'])+ ','+ str(WIND_T_WITH_L['CMD'])+ ','+ str(WIND_T_WITH_L['TYPE'])+ ','+
               str(WIND_T_WITH_L['DIR'])+ ','+ str(WIND_T_WITH_L['bPROJ'])+ ','+ str(WIND_T_WITH_L['bECCEN'])+ ','+
               str(WIND_T_WITH_L['ECCDIR'])+ ','+ str(WIND_T_WITH_L['D1'])+ ','+ str(WIND_T_WITH_L['P1'])+','+str(WIND_T_WITH_L['D2'])+','+
               str(WIND_T_WITH_L['P2'])+ ','+ str(WIND_T_WITH_L['D3'])+ ','+ str(WIND_T_WITH_L['P3'])+ ','+ str(WIND_T_WITH_L['D4'])+ ','+
               str(WIND_T_WITH_L['P4'])+ ','+ str(WIND_T_WITH_L['GROUP'])+ ','+ str(WIND_T_WITH_L['ADDITIONAL'])+'\n')

# 定义横向无车风荷载
result.write('''
*USE-STLD, WIND_T_WITHOUT_L

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
WIND_T_WITHOUT_L = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GY', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'WIND_T_WITHOUT_L','ADDITIONAL':'NO, 0, 0, NO,'}
# 横向无车风荷载_上部结构
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         WIND_T_WITHOUT_L = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GY',
                             'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                             'D1': 0, 'P1':LOAD_CASE.loc['WIND_T_WITHOUT_L_SUPER']['VALUE'], 'D2': 1,
                             'P2': LOAD_CASE.loc['WIND_T_WITHOUT_L_SUPER']['VALUE'],'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,
                             'GROUP': 'WIND_T_WITHOUT_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_T_WITHOUT_L['ELEM_LIST'])+','+ str(WIND_T_WITHOUT_L['CMD'])+','+ str(WIND_T_WITHOUT_L['TYPE'])+','+
               str(WIND_T_WITHOUT_L['DIR'])+','+str(WIND_T_WITHOUT_L['bPROJ'])+','+str(WIND_T_WITHOUT_L['bECCEN'])+','+
               str(WIND_T_WITHOUT_L['ECCDIR'])+','+str(WIND_T_WITHOUT_L['D1'])+','+str(WIND_T_WITHOUT_L['P1'])+','+
               str(WIND_T_WITHOUT_L['D2'])+','+str(WIND_T_WITHOUT_L['P2'])+','+str(WIND_T_WITHOUT_L['D3'])+','+
               str(WIND_T_WITHOUT_L['P3'])+','+str(WIND_T_WITHOUT_L['D4'])+','+str(WIND_T_WITHOUT_L['P4'])+','+
               str(WIND_T_WITHOUT_L['GROUP'])+','+str(WIND_T_WITHOUT_L['ADDITIONAL'])+'\n')
# 横向无车风荷载_下部结构
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(0,3,1):
         WIND_T_WITHOUT_L = {'ELEM_LIST': EPIERP[SPAN,I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GY',
                          'bPROJ': 'NO', 'bECCEN': 'NO', 'ECCDIR': 'aDir[1], , ,',
                          'D1': 0, 'P1': LOAD_CASE.loc['WIND_T_WITHOUT_L_SUB']['VALUE'], 'D2': 1,
                          'P2': LOAD_CASE.loc['WIND_T_WITHOUT_L_SUB']['VALUE'], 'D3': 0, 'P3': 0, 'D4': 0, 'P4': 0,
                          'GROUP': 'WIND_T_WITHOUT_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_T_WITHOUT_L['ELEM_LIST'])+ ','+ str(WIND_T_WITHOUT_L['CMD'])+ ','+ str(WIND_T_WITHOUT_L['TYPE'])+ ','+
               str(WIND_T_WITHOUT_L['DIR'])+ ','+ str(WIND_T_WITHOUT_L['bPROJ'])+ ','+str(WIND_T_WITHOUT_L['bECCEN'])+ ','+
               str(WIND_T_WITHOUT_L['ECCDIR'])+ ','+ str(WIND_T_WITHOUT_L['D1'])+ ','+ str(WIND_T_WITHOUT_L['P1'])+','+
               str(WIND_T_WITHOUT_L['D2'])+','+str(WIND_T_WITHOUT_L['P2'])+ ','+ str(WIND_T_WITHOUT_L['D3'])+ ','+
               str(WIND_T_WITHOUT_L['P3'])+ ','+ str(WIND_T_WITHOUT_L['D4'])+ ','+str(WIND_T_WITHOUT_L['P4'])+ ','+
               str(WIND_T_WITHOUT_L['GROUP'])+ ','+ str(WIND_T_WITHOUT_L['ADDITIONAL'])+'\n')

# 定义竖向有车风荷载
result.write('''
*USE-STLD, WIND_V_WITH_L

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
WIND_V_WITH_L = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GZ', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'WIND_V_WITH_L','ADDITIONAL':'NO, 0, 0, NO,'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         WIND_V_WITH_L = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GZ',
                          'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                          'D1': 0, 'P1':LOAD_CASE.loc['WIND_V_WITH_L']['VALUE'], 'D2': 1,
                          'P2': LOAD_CASE.loc['WIND_V_WITH_L']['VALUE'],'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,
                          'GROUP': 'WIND_V_WITH_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_V_WITH_L['ELEM_LIST'])+','+ str(WIND_V_WITH_L['CMD'])+','+ str(WIND_V_WITH_L['TYPE'])+','+
               str(WIND_V_WITH_L['DIR'])+','+str(WIND_V_WITH_L['bPROJ'])+','+str(WIND_V_WITH_L['bECCEN'])+','+
               str(WIND_V_WITH_L['ECCDIR'])+','+str(WIND_V_WITH_L['D1'])+','+str(WIND_V_WITH_L['P1'])+','+str(WIND_V_WITH_L['D2'])+','+
               str(WIND_V_WITH_L['P2'])+','+str(WIND_V_WITH_L['D3'])+','+str(WIND_V_WITH_L['P3'])+','+str(WIND_V_WITH_L['D4'])+','+
               str(WIND_V_WITH_L['P4'])+','+str(WIND_V_WITH_L['GROUP'])+','+str(WIND_V_WITH_L['ADDITIONAL'])+'\n')

# 定义竖向无车风荷载
result.write('''
*USE-STLD, WIND_V_WITHOUT_L

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
WIND_V_WITHOUT_L = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GZ', 'bPROJ':'NO', 'bECCEN':'NO',
           'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
           'GROUP':'WIND_V_WITHOUT_L','ADDITIONAL':'NO, 0, 0, NO,'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         WIND_V_WITHOUT_L = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GZ',
                             'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                             'D1': 0, 'P1':LOAD_CASE.loc['WIND_V_WITHOUT_L']['VALUE'], 'D2': 1,
                             'P2': LOAD_CASE.loc['WIND_V_WITHOUT_L']['VALUE'],'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,
                             'GROUP': 'WIND_V_WITHOUT_L', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_V_WITHOUT_L['ELEM_LIST'])+','+ str(WIND_V_WITHOUT_L['CMD'])+','+ str(WIND_V_WITHOUT_L['TYPE'])+','+
               str(WIND_V_WITHOUT_L['DIR'])+','+str(WIND_V_WITHOUT_L['bPROJ'])+','+str(WIND_V_WITHOUT_L['bECCEN'])+','+
               str(WIND_V_WITHOUT_L['ECCDIR'])+','+str(WIND_V_WITHOUT_L['D1'])+','+str(WIND_V_WITHOUT_L['P1'])+','+
               str(WIND_V_WITHOUT_L['D2'])+','+str(WIND_V_WITHOUT_L['P2'])+','+str(WIND_V_WITHOUT_L['D3'])+','+
               str(WIND_V_WITHOUT_L['P3'])+','+str(WIND_V_WITHOUT_L['D4'])+','+str(WIND_V_WITHOUT_L['P4'])+','+
               str(WIND_V_WITHOUT_L['GROUP'])+','+str(WIND_V_WITHOUT_L['ADDITIONAL'])+'\n')

# 定义纵向风荷载
result.write('''
*USE-STLD, WIND_L_MAX

*BEAMLOAD    ; Element Beam Loads
; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
''')
WIND_L_MAX = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GX', 'bPROJ':'NO', 'bECCEN':'NO',
              'ECCDIR':'aDir[1], , ,', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
              'GROUP':'WIND_L_MAX','ADDITIONAL':'NO, 0, 0, NO,'}
# 纵向风荷载_上部结构
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in range(JN-1):
         WIND_L_MAX = {'ELEM_LIST': EP[SPAN][I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GX',
                       'bPROJ': 'NO', 'bECCEN': 'NO','ECCDIR': 'aDir[1], , ,',
                       'D1': 0, 'P1':LOAD_CASE.loc['WIND_L_MAX_SUPER']['VALUE'], 'D2': 1,
                       'P2': LOAD_CASE.loc['WIND_L_MAX_SUPER']['VALUE'],'D3': 0, 'P3': 0, 'D4': 0 ,'P4': 0,
                       'GROUP': 'WIND_L_MAX', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_L_MAX['ELEM_LIST'])+','+ str(WIND_L_MAX['CMD'])+','+ str(WIND_L_MAX['TYPE'])+','+
               str(WIND_L_MAX['DIR'])+','+str(WIND_L_MAX['bPROJ'])+','+str(WIND_L_MAX['bECCEN'])+','+
               str(WIND_L_MAX['ECCDIR'])+','+str(WIND_L_MAX['D1'])+','+str(WIND_L_MAX['P1'])+','+
               str(WIND_L_MAX['D2'])+','+str(WIND_L_MAX['P2'])+','+str(WIND_L_MAX['D3'])+','+
               str(WIND_L_MAX['P3'])+','+str(WIND_L_MAX['D4'])+','+str(WIND_L_MAX['P4'])+','+
               str(WIND_L_MAX['GROUP'])+','+str(WIND_L_MAX['ADDITIONAL'])+'\n')
# 纵向风荷载_下部结构
for SPAN in range(SPAN_NOS+1):
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      for J in range(0,3,1):
         WIND_L_MAX = {'ELEM_LIST': EPIERP[SPAN,I,J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD', 'DIR': 'GX',
                        'bPROJ': 'NO', 'bECCEN': 'NO', 'ECCDIR': 'aDir[1], , ,',
                        'D1': 0, 'P1': LOAD_CASE.loc['WIND_L_MAX_SUB']['VALUE'], 'D2': 1,
                        'P2': LOAD_CASE.loc['WIND_L_MAX_SUB']['VALUE'], 'D3': 0, 'P3': 0, 'D4': 0, 'P4': 0,
                        'GROUP': 'WIND_L_MAX', 'ADDITIONAL': 'NO, 0, 0, NO,'}
         result.write('  '+ str(WIND_L_MAX['ELEM_LIST'])+ ','+ str(WIND_L_MAX['CMD'])+ ','+ str(WIND_L_MAX['TYPE'])+ ','+
               str(WIND_L_MAX['DIR'])+ ','+ str(WIND_L_MAX['bPROJ'])+ ','+ str(WIND_L_MAX['bECCEN'])+ ','+
               str(WIND_L_MAX['ECCDIR'])+ ','+ str(WIND_L_MAX['D1'])+ ','+ str(WIND_L_MAX['P1'])+ ','+
               str(WIND_L_MAX['D2'])+ ','+ str(WIND_L_MAX['P2'])+ ','+ str(WIND_L_MAX['D3'])+ ','+
               str(WIND_L_MAX['P3'])+ ','+ str(WIND_L_MAX['D4'])+ ','+ str(WIND_L_MAX['P4'])+ ','+
               str(WIND_L_MAX['GROUP'])+ ','+ str(WIND_L_MAX['ADDITIONAL'])+'\n')

# 定义结构连续预应力墩顶反力
result.write('''
*USE-STLD, PTF

*CONLOAD    ; Nodal Loads
; NODE_LIST, FX, FY, FZ, MX, MY, MZ, GROUP
''')
PTF = {'NODE_LIST':0, 'FX':0, 'FY':0,'FZ':0,'MX':0,'MY':0,'MZ':0,'GROUP':'PTF'}
for SPAN in range(SPAN_NOS):
   JN, TTYPE = SPAN_JN_TYPE(SPAN)
   for I in range(1,IN,2):
      for J in [0,JN-1]:
         # 后期增加结构连续与桥面连续判断条件
         PTF = {'NODE_LIST': NP[SPAN][I,J]['iNO'], 'FX': 0,'FY': 0,'FZ': LOAD_CASE.loc['PTF']['VALUE'],
                'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'PTF'}
         result.write('  '+ str(PTF['NODE_LIST'])+ ','+ str(PTF['FX'])+ ','+ str(PTF['FY'])+ ','+str(PTF['FZ'])+
               ','+ str(PTF['MX'])+ ','+ str(PTF['MY'])+ ','+ str(PTF['MY'])+ ','+ str(PTF['GROUP'])+'\n')

# 定义侧向滑移力
SKIDDING0 = {'NODE_LIST':0, 'FX':0, 'FY':0,'FZ':0,'MX':0,'MY':0,'MZ':0,'GROUP':'SKIDDING'}
SKIDDING1 = {'NODE_LIST':0, 'FX':0, 'FY':0,'FZ':0,'MX':0,'MY':0,'MZ':0,'GROUP':'SKIDDING'}
for SPAN in range(SPAN_NOS+1):
   result.write('   *USE-STLD, SKIDDING_' + str(LEVEL_DATA.iloc[SPAN][0]))
   result.write('''
   *CONLOAD    ; Nodal Loads
   ; NODE_LIST, FX, FY, FZ, MX, MY, MZ, GROUP
   ''')
   if SPAN > 0:
       JN, TTYPE = SPAN_JN_TYPE(SPAN-1)
   if SPAN == 0:
      JN, TTYPE = SPAN_JN_TYPE(SPAN)
      SKIDDING0 = {'NODE_LIST': NP[SPAN][int((IN-1)/2),0]['iNO'], 'FX': 0,'FY': LOAD_CASE.loc['SKIDDING']['VALUE'],'FZ': 0,
                  'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'SKIDDING'}
      result.write('  '+ str(SKIDDING0['NODE_LIST'])+ ','+ str(SKIDDING0['FX'])+ ','+ str(SKIDDING0['FY'])+ ','+ str(SKIDDING0['FZ'])+
            ','+ str(SKIDDING0['MX'])+ ','+ str(SKIDDING0['MY'])+ ','+ str(SKIDDING0['MY'])+ ','+ str(SKIDDING0['GROUP'])+'\n')
   elif SPAN == SPAN_NOS:
      SKIDDING1 = {'NODE_LIST': NP[SPAN-1][ int((IN - 1) / 2), JN - 1]['iNO'], 'FX': 0, 'FY': LOAD_CASE.loc['SKIDDING']['VALUE'],
                   'FZ': 0, 'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'SKIDDING'}
      result.write('  '+ str(SKIDDING1['NODE_LIST'])+ ','+ str(SKIDDING1['FX'])+ ','+ str(SKIDDING1['FY'])+ ','+ str(SKIDDING1['FZ'])+
            ','+ str(SKIDDING1['MX'])+ ','+ str(SKIDDING1['MY'])+ ','+ str(SKIDDING1['MY'])+ ','+ str(SKIDDING1['GROUP'])+'\n')
   else:
       SKIDDING0 = {'NODE_LIST': NP[SPAN - 1][int((IN - 1) / 2), JN - 1]['iNO'], 'FX': 0,
                    'FY': LOAD_CASE.loc['SKIDDING']['VALUE'] / 2,
                    'FZ': 0, 'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'SKIDDING'}
       SKIDDING1 = {'NODE_LIST': NP[SPAN][int((IN - 1) / 2), 0]['iNO'], 'FX': 0,
                    'FY': LOAD_CASE.loc['SKIDDING']['VALUE'] / 2,
                    'FZ': 0, 'MX': 0, 'MY': 0, 'MZ': 0, 'GROUP': 'SKIDDING'}
       result.write('  '+ str(SKIDDING0['NODE_LIST'])+ ','+ str(SKIDDING0['FX'])+ ','+ str(SKIDDING0['FY'])+ ','+ str(SKIDDING0['FZ'])+
             ','+ str(SKIDDING0['MX'])+ ','+ str(SKIDDING0['MY'])+ ','+ str(SKIDDING0['MY'])+ ','+ str(SKIDDING0['GROUP'])+'\n')
       result.write('  '+ str(SKIDDING1['NODE_LIST'])+ ','+ str(SKIDDING1['FX'])+ ','+ str(SKIDDING1['FY'])+ ','+ str(SKIDDING1['FZ'])+
             ','+ str(SKIDDING1['MX'])+ ','+ str(SKIDDING1['MY'])+ ','+ str(SKIDDING1['MY'])+ ','+ str(SKIDDING1['GROUP'])+'\n')

# 定义车辆制动力
TRACTION = {'ELEM_LIST':0, 'CMD':'BEAM', 'TYPE':'UNILOAD', 'DIR':'GX', 'bPROJ':'NO', 'bECCEN':'YES',
              'ECCDIR':'1,LY,'+str(0)+','+str(0)+',NO', 'D1':0, 'P1':0, 'D2':0, 'P2':0,'D3':0, 'P3':0, 'D4':0 ,'P4':0,
              'GROUP':'TRACTION','ADDITIONAL':'NO, 0, 0, NO,'}
for LANE in range(GENERAL_INFO.loc['LANE_NOS']['VALUE']):
    result.write('*USE-STLD,TRACTION_' + str(LANE + 1))
    result.write('''
   *BEAMLOAD    ; Element Beam Loads
   ; ELEM_LIST, CMD, TYPE, DIR, bPROJ, [ECCEN], [VALUE], GROUP
   ; ELEM_LIST, CMD, TYPE, TYPE, DIR, VX, VY, VZ, bPROJ, [ECCEN], [VALUE], GROUP
   ; [VALUE]       : D1, P1, D2, P2, D3, P3, D4, P4
   ; [ECCEN]       : bECCEN, ECCDIR, I-END, J-END, bJ-END
   ; [ADDITIONAL]  : bADDITIONAL, ADDITIONAL_I-END, ADDITIONAL_J-END, bADDITIONAL_J-END
   ''')
    for SPAN in range(SPAN_NOS):
        JN, TTYPE = SPAN_JN_TYPE(SPAN)
        for J in range(JN - 1):
            OFFSET = (-float(GENERAL_INFO.loc['LANE_NOS']['VALUE'] / 2) + LANE + 0.5) * float(
                GENERAL_INFO.loc['LANE_WIDTH']['VALUE'])
            TRACTION = {'ELEM_LIST': EP[SPAN][int((IN - 1) / 2), J]['iEL'], 'CMD': 'BEAM', 'TYPE': 'UNILOAD','DIR': 'GX',
                        'bPROJ': 'NO', 'bECCEN': 'YES', 'ECCDIR': '1,LY,' + str(OFFSET) + ',' + str(OFFSET) + ',NO', 'D1': 0,
                        'P1': LOAD_CASE.loc['TRACTION']['VALUE'], 'D2': 1, 'P2': LOAD_CASE.loc['TRACTION']['VALUE'],
                        'D3': 0, 'P3': 0, 'D4': 0, 'P4': 0,'GROUP': 'TRACTION', 'ADDITIONAL': 'NO, 0, 0, NO,'}
            result.write('  '+ str(TRACTION['ELEM_LIST'])+ ','+ str(TRACTION['CMD'])+ ','+ str(TRACTION['TYPE'])+ ','+
                  str(TRACTION['DIR'])+ ','+ str(TRACTION['bPROJ'])+ ','+ str(TRACTION['bECCEN'])+ ','+
                  str(TRACTION['ECCDIR'])+ ','+ str(TRACTION['D1'])+ ','+ str(TRACTION['P1'])+ ','+
                  str(TRACTION['D2'])+ ','+ str(TRACTION['P2'])+ ','+ str(TRACTION['D3'])+ ','+
                  str(TRACTION['P3'])+ ','+ str(TRACTION['D4'])+ ','+ str(TRACTION['P4'])+ ','+
                  str(TRACTION['GROUP'])+ ','+ str(TRACTION['ADDITIONAL'])+'\n')

# 定义施工阶段
result.write('''
*STAGE    ; Define Construction Stage
; NAME=NAME, DURATION, bSAVESTAGE, bSAVESTEP, bINCRESTEP, INCRESTEP  ; line 1
; STEP=DAY1, DAY2, ...                                               ; line 2
; AELEM=GROUP1, AGE1, GROUP2, AGE2, ...                              ; line 3
; DELEM=GROUP1, REDIST1, GROUP2, REDIST2, ...                        ; line 4
; ABNDR=BGROUP1, POS1, BGROUP2, POS2, ...                            ; line 5
; DBNDR=BGROUP1, BGROUP2, ...                                        ; line 6
; ALOAD=LGROUP1, DAY1, LGROUP2, DAY2, ...                            ; line 7
; DLOAD=LGROUP1, DAY1, LGROUP2, DAY2, ...                            ; line 8
  NAME=01.SUBSTRUCTURE, 20, YES, NO, NO, 5
  AELEM=SUBSTRUCTURE, 7
  ABNDR=SOIL SPRINGS, ORIGINAL, PILE PIN_SUPPORTS, ORIGINAL
  ALOAD=SELF_WEIGHT, FIRST
  NAME=02.T GIRDER, 100, YES, NO, NO, 5
  AELEM=BEARINGS, 0, T GIRDER, 90
  ABNDR=T GIRDER_RIGID LINKS, ORIGINAL, BEARINGS, ORIGINAL
  NAME=03.DIAPHRAGMS, 20, YES, NO, NO, 5
  AELEM=MID DIAPHRAGMS, 7, END DIAPHRAGMS, 7
  NAME=04.CONTINUOUS, 14, YES, NO, NO, 5
  AELEM=CAST_IN_SITU, 7
  ALOAD=PTF, LAST
  NAME=05.WET JOINT, 14, YES, NO, NO, 5
  AELEM=WET SLAB, 7, TG_WJ CONNECTION, 7
  NAME=06.DECK SLAB, 20, YES, NO, NO, 5
  AELEM=DECK SLAB, 7, ASPHALT, 10
  ALOAD=PARAPET, LAST, SERVICES, LAST, ASPHALT, FIRST
  NAME=07.RUN, 10000, YES, NO, NO, 5
  STEP=2, 5, 12, 28, 66, 152, 351, 811, 1874, 4329
''')

# 定义移动荷载规范及车辆
result.write('''
*MVLDCODE    ; Moving Load Code
; CODE=CODE
   CODE=BS
''')

# 定义车道面
result.write('''
*SURFLANE    ; Traffic Surface Lanes
; NAME=NAME, WIDTH, START, END, MOVING, WS, bLANEOPT, ALLOWWIDTH  ; line 1
;      iNODE1, OFFSET1, FACT1, bSPAN1, ECCVL ...                  ; from line 2
;      iNODE1, OFFSET1, nTYPE, dSPAN, dFACT, ...                  ; from line 2
''')
LANE0 = {'NAME':'NAME =', 'WIDTH':GENERAL_INFO.loc['LANE_WIDTH']['VALUE'], 'START':0, 'END':0,
         'MOVING':'FORWARD', 'WS':0.6, 'bLANEOPT':'NO', 'ALLOWWIDTH':0}
LANE1 = {'iNODE1':0, 'OFFSET1':0, 'FACT1':0, 'bSPAN1':'NO,0,0.5',
         'iNODE2':0, 'OFFSET2':0, 'FACT2':0, 'bSPAN2':'NO,0,0.5'}
JN, TTYPE = SPAN_JN_TYPE(SPAN_NOS-1)
for I in range(GENERAL_INFO.loc['LANE_NOS']['VALUE']):
   OFFSET = (-float(GENERAL_INFO.loc['LANE_NOS']['VALUE']/2)+I+0.5)*float(GENERAL_INFO.loc['LANE_WIDTH']['VALUE'])
   LANE0 = {'NAME': 'NAME = LANE'+str(I+1), 'WIDTH': GENERAL_INFO.loc['LANE_WIDTH']['VALUE'], 'START': 0, 'END': 0,
            'MOVING': 'FORWARD', 'WS': 0.6, 'bLANEOPT': 'NO', 'ALLOWWIDTH': 0}
   LANE1 = {'iNODE1': NUP[0][int((IN-1)/2),0]['iNO'], 'OFFSET1': OFFSET,'FACT1': 0, 'bSPAN1': 'NO,0,0.5',
            'iNODE2': NUP[SPAN_NOS-1][int((IN-1)/2),JN-1]['iNO'], 'OFFSET2': OFFSET,'FACT2': 0, 'bSPAN2': 'NO,0,0.5'}
   result.write('  '+ str(LANE0['NAME'])+ ','+ str(LANE0['WIDTH'])+ ','+ str(LANE0['START'])+ ','+ str(LANE0['END'])+
         ','+ str(LANE0['MOVING'])+ ','+ str(LANE0['WS'])+ ','+ str(LANE0['bLANEOPT'])+ ','+ str(LANE0['ALLOWWIDTH'])+'\n')
   result.write('     '+ str(LANE1['iNODE1'])+ ','+ str(LANE1['OFFSET1'])+ ','+ str(LANE1['FACT1'])+ ','+ str(LANE1['bSPAN1'])+
         ','+ str(LANE1['iNODE2'])+ ','+ str(LANE1['OFFSET2'])+ ','+ str(LANE1['FACT2'])+ ','+ str(LANE1['bSPAN2'])+'\n')

# 定义车辆
result.write('''
*VEHICLE    ; Vehicles
   NAME=HA, 1, HA, BS BD 37/01, 30, , YES, NO, 1, YES, 0, 1.2, 1.1, 0 , 0, 1, 1, 0.5, 0.4, NO, 3.65, 0, 0
   NAME=HA & HB(Auto)-(25), 1, HA & HB(Auto), BS BD 37/01, 25, , YES, NO, 1, YES, 0, 1.2, 1.1, 0 , 0, 1, 1, 0.5, 0.4, NO, 3.65, 0, 0
   NAME=HA & HB(Auto)-(30), 1, HA & HB(Auto), BS BD 37/01, 30, , YES, NO, 1, YES, 0, 1.2, 1.1, 0 , 0, 1, 1, 0.5, 0.4, NO, 3.65, 0, 0
''')

# 定义移动荷载工况
if int(GENERAL_INFO.loc['LANE_NOS']['VALUE']) == 1:
   result.write('''
   *MVLDCASE(BS)   ; Moving Load Cases
      NAME=HA, , NO, 1, NO, 0, 0, 0, 0
           1
           1, HA, 1, LANE1
      NAME=HA&HB-(30), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(30), 1, LANE1
      NAME=HA&HB-(25), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(25), 1, LANE1
   ''')
elif int(GENERAL_INFO.loc['LANE_NOS']['VALUE']) == 2:
   result.write('''
   *MVLDCASE(BS)   ; Moving Load Cases
      NAME=HA, , NO, 1, NO, 0, 0, 0, 0
           1
           1, HA, 2, LANE1, LANE2
      NAME=HA&HB-(30), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(30), 2, LANE1, LANE2, LANE1, LANE2
      NAME=HA&HB-(25), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(25), 2, LANE1, LANE2,  LANE1, LANE2
   ''')

elif int(GENERAL_INFO.loc['LANE_NOS']['VALUE']) == 3:
   result.write('''
   *MVLDCASE(BS)   ; Moving Load Cases
      NAME=HA, , NO, 1, NO, 0, 0, 0, 0
           1
           1, HA, 3, LANE1, LANE2, LANE3
      NAME=HA&HB-(30), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(30), 3, LANE1, LANE2, LANE3, LANE1, LANE2,LANE2, LANE3
      NAME=HA&HB-(25), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(25), 3, LANE1, LANE2, LANE3, LANE1, LANE2, LANE2, LANE3
   ''')

elif int(GENERAL_INFO.loc['LANE_NOS']['VALUE']) == 4:
   result.write('''
   *MVLDCASE(BS)   ; Moving Load Cases
      NAME=HA, , NO, 1, NO, 0, 0, 0, 0
           1
           1, HA, 4, LANE1, LANE2, LANE3, LANE4
      NAME=HA&HB-(30), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(30), 4, LANE1, LANE2, LANE3,LANE4, LANE1, LANE2,LANE2, LANE3, LANE3,LANE4
      NAME=HA&HB-(25), , NO, 1, YES, 1, 1, 1, 0
           1
           1, HA & HB(Auto)-(25), 4, LANE1, LANE2, LANE3,LANE4, LANE1, LANE2, LANE2, LANE3, LANE3,LANE4
   ''')


# 定义沉降荷载
result.write('''
*SM-GROUP    ; Settlement Group
; GRNAME, DISPLACEMENT, NODE_LIST
''')
SM = {'GRNAME':'0', 'DISPLACEMENT':-0.01, 'NODE_LIST':0}
for SPAN in range(SPAN_NOS+1):
   NODE_LIST = ' '
   for I in range(int(GENERAL_INFO.loc['COLUMN_NOS']['VALUE'])):
      NODE_LIST0 = str(NPILEP[SPAN][I,len(SOIL_SPRING[(LEVEL_DATA.iloc[SPAN][0],'DISTANCE')].dropna())-2]['iNO'])
      NODE_LIST = NODE_LIST + '  ' + NODE_LIST0
   SM = {'GRNAME':LEVEL_DATA.iloc[SPAN][0], 'DISPLACEMENT':-0.01,
         'NODE_LIST':NODE_LIST}
   result.write('     '+ str(SM['GRNAME'])+ ','+ str(SM['DISPLACEMENT'])+ ','+ str(SM['NODE_LIST'])+'\n')

# 定义沉降荷载工况
result.write('''
*SMLDCASE    ; Settlement Load Cases
; NAME=NAME, iSMIN, iSMAX, SCALE, DESC ; line 1
;      GRNAME1, GRNAME2, ...           ; from line 2

''')
result.write('  NAME=SETTLEMENT'+','+'1'+','+str(SPAN_NOS-1)+','+'1'+','+'\n')
for SPAN in range(SPAN_NOS+1):
   if SPAN == SPAN_NOS:
      result.write(str(LEVEL_DATA.iloc[SPAN][0])+'\n')
   else:
      result.write(str(LEVEL_DATA.iloc[SPAN][0])+',\\'+'\n')

# 施工阶段分析控制数据
result.write('''
*STAGE-CTRL    ; Construction Stage Analysis Control Data
; bLAST-FINAL, FINAL-STAGE, CPFC, bEXT_REPL, bCALC-CFF, bCALC-CSP, bAPPLY-IMF,                    \ ; line 1
; bCONV, bTRUSS, bBEAM, bITD, iITD, GROUP,                                                        \ ; line 1
; bSAVE-OCS, bLFFC, LFFGR, bCAMBER, bSELFCONS, bCHANGE-CABLE                                         ; line 1
; bINC-NLA, iNLA-TYPE, bIEMF, iLSTEP, iMAXITER, bENEG, EV, bDISP, DV, bFORC, FV, CF, BSSTEP, ADSTEP  ; line 2
; bINC-PDL, iITER, TOL                                                                               ; line 3
; bINC-TDE, bCNS, TYPE, iITER, TOL, bTTLE_CS, bRCE, bVAR, bTTLE_ES, iTTLE_ES, bAPPLY-ELA             ; line 4
; bOUCC, bITS, iITS, bATS, iT10, iT100, iT1K, iT5K, iT10K                                            ; line 5
; bSD, iSDOPT, SDCONST, iBSC, bSDLE, GLC1, GLC2, ...                                                 ; line 6
; LTYPECC, EREC, LCNAME1, LCNAME2, LCNAME3, ...                                                      ; from line 7~end
  YES, , INTERNAL, NO, YES, YES, NO, NO, NO, NO, NO, , , NO, NO, , NO, YES, NO
  0 
  NO
  YES, YES, BOTH, 5, 0.01, YES, NO, YES, YES, 0, NO
  NO, NO, 2, YES, 2, 5, 7, 10, 20
  NO, , , 1, NO
  SELF_WEIGHT, D, SELF_WEIGHT
  PARAPET+SERVICES, DC, PARAPET, SERVICES
  PTF, DC, PTF
''')

# 定义移动荷载分析控制数据
result.write('''
*MOVE-CTRL(BS)    ; Moving Load Analysis Control
; iIGP, UNUM, PLATE, bSTRCALC, bCONCURRENT, FRAME, bCSTRCALC, bREAC, bRGP, RGP, bDISP, bDGP, DGP, bFM, bFGP, FGP, bL, bLG, LGP, NUMLANE
   0, 3, NODAL, NO, NO, AXIAL, NO,   NO, NO, ,   YES, YES, SUBSTRUCTURE,   YES, YES, SUBSTRUCTURE,   YES, NO, ,   1
''')

# 定义沉降分析控制数据
result.write('''
*SM-CTRL    ; Settlement Analysis Control Data
; bCONCURRENT, bCONCLINK                                          ; line 1
   NO, NO
''')

# 定义荷载组合
result.write('''
*LOADCOMB    ; Combinations
; NAME=NAME, KIND, ACTIVE, bES, iTYPE, DESC, iSERV-TYPE, nLCOMTYPE, nSEISTYPE   ; line 1
;      ANAL1, LCNAME1, FACT1, ...                                               ; from line 2
   NAME=settle-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        SM, SETTLEMENT, 1
   NAME=+SK-EN, CONC, INACTIVE, 0, 1, , 0, 0, 0     
''')

for SPAN in range(SPAN_NOS+1):
   result.write('   ST,SKIDDING_'+str(LEVEL_DATA.iloc[SPAN][0])+',1'+'\n')  # 定义侧向滑移荷载组合

result.write('''
   NAME=-SK-EN, CONC, INACTIVE, 0, 0, , 0, 0, 0
        CBC, +SK-EN, -1
   NAME=SK-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, +SK-EN, 1, CBC, -SK-EN, 1
   NAME=TU-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        ST, T_36, 1, ST, T_20, 1
   NAME=+WIND-WIL-EN, CONC, INACTIVE, 0, 1, , 0, 0, 0
        ST, WIND_T_WITH_L, 1, ST, WIND_L_MAX, 1, ST, WIND_V_WITH_L, 1
   NAME=-WIND-WIL-EN, CONC, INACTIVE, 0, 0, , 0, 0, 0
        CBC, +WIND-WIL-EN, -1
   NAME=WIND-WIL-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, +WIND-WIL-EN, 1, CBC, -WIND-WIL-EN, 1
   NAME=+WIND-WOL-EN, CONC, INACTIVE, 0, 1, , 0, 0, 0
        ST, WIND_T_WITHOUT_L, 1, ST, WIND_V_WITHOUT_L, 1, ST, WIND_L_MAX, 1
   NAME=-WIND-WOL-EN, CONC, INACTIVE, 0, 0, , 0, 0, 0
        CBC, +WIND-WOL-EN, -1
   NAME=WIND-WOL-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, +WIND-WOL-EN, 1, CBC, -WIND-WOL-EN, 1
   NAME=+TRACTION-EN, CONC, INACTIVE, 0, 1, , 0, 0, 0
''')

for LANE in range(GENERAL_INFO.loc['LANE_NOS']['VALUE']):   # 定义制动力荷载组合
   result.write('   ST,TRACTION_'+str(LANE+1)+',1'+'\n')

result.write('''   
   NAME=-TRACTION-EN, CONC, INACTIVE, 0, 0, , 0, 0, 0
        CBC, +TRACTION-EN, -1
   NAME=TRACTION-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, +TRACTION-EN, 1, CBC, -TRACTION-EN, 1
   NAME=ULS-Permanent, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, SERVICES, 1.2, ST, C&S_TEM, 1.2, CS, SELF_WEIGHT, 1.15
        CS, PARAPET+SERVICES, 1.2, CS, PTF, 1, CS, Creep Secondary, 1.2
        CS, Shrinkage Secondary, 1.2, CBC, settle-EN, 1.2, ST, ASPHALT, 1.75
   NAME=ULS1-D+CS+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.5, CBC, ULS-Permanent, 1
   NAME=ULS1-D+CS+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(30), 1.3, CBC, ULS-Permanent, 1
   NAME=ULS2-D+CS+W+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.25, CBC, WIND-WIL-EN, 1.1, CBC, ULS-Permanent, 1
   NAME=ULS2-D+CS+W+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(30), 1.1, CBC, WIND-WIL-EN, 1.1, CBC, ULS-Permanent, 1
   NAME=ULS2-D+CS+WOL, CONC, STRENGTH, 0, 0, , 0, 0, 0
        CBC, WIND-WOL-EN, 1.4, CBC, ULS-Permanent, 1
   NAME=ULS2-D+CS+FL+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, FLOOD_LOAD, 1.5, MV, HA, 1.25, CBC, ULS-Permanent, 1
   NAME=ULS2-D+CS+FL+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, FLOOD_LOAD, 1.5, MV, HA&HB-(30), 1.1, CBC, ULS-Permanent, 1
   NAME=ULS3-D+CS+TU+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.25, CBC, TU-EN, 1.3, CBC, ULS-Permanent, 1
   NAME=ULS3-D+CS+TU+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(30), 1.1, CBC, TU-EN, 1.3, CBC, ULS-Permanent, 1
   NAME=ULS4-D+CS+TR+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.25, CBC, TRACTION-EN, 1.25, CBC, ULS-Permanent, 1
   NAME=ULS4-D+CS+TR+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(30), 1.1, CBC, TRACTION-EN, 1.1, CBC, ULS-Permanent, 1
   NAME=ULS4-D+CS+SK+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.25, CBC, SK-EN, 1.25, CBC, ULS-Permanent, 1
   NAME=ULS-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, ULS1-D+CS+HA, 1, CBC, ULS1-D+CS+HA&HB, 1, CBC, ULS2-D+CS+W+HA, 1
        CBC, ULS2-D+CS+W+HA&HB, 1, CBC, ULS2-D+CS+WOL, 1
        CBC, ULS2-D+CS+FL+HA, 1, CBC, ULS2-D+CS+FL+HA&HB, 1
        CBC, ULS3-D+CS+TU+HA, 1, CBC, ULS3-D+CS+TU+HA&HB, 1
        CBC, ULS4-D+CS+TR+HA, 1, CBC, ULS4-D+CS+TR+HA&HB, 1
        CBC, ULS4-D+CS+SK+HA, 1
   NAME=SLS-Permanent, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, SERVICES, 1, ST, C&S_TEM, 1, CS, SELF_WEIGHT, 1
        CS, PARAPET+SERVICES, 1, CS, PTF, 1, CS, Creep Secondary, 1
        CS, Shrinkage Secondary, 1, CBC, settle-EN, 1, ST, ASPHALT, 1.2
   NAME=SLS1-D+CS+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1.2, CBC, SLS-Permanent, 1
   NAME=SLS1-D+CS+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(25), 1.1, CBC, SLS-Permanent, 1
   NAME=SLS2-D+CS+W+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1, CBC, WIND-WIL-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS2-D+CS+W+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(25), 1, CBC, WIND-WIL-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS2-D+CS+WOL, CONC, STRENGTH, 0, 0, , 0, 0, 0
        CBC, WIND-WOL-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS2-D+CS+FL+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, FLOOD_LOAD, 1.2, MV, HA, 1, CBC, SLS-Permanent, 1
   NAME=SLS2-D+CS+FL+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, FLOOD_LOAD, 1.2, MV, HA&HB-(25), 1, CBC, SLS-Permanent, 1
   NAME=SLS3-D+CS+TU+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1, CBC, TU-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS3-D+CS+TU+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(25), 1, CBC, TU-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS4-D+CS+TR+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1, CBC, TRACTION-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS4-D+CS+TR+HA&HB, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA&HB-(25), 1, CBC, TRACTION-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS4-D+CS+SK+HA, CONC, STRENGTH, 0, 0, , 0, 0, 0
        MV, HA, 1, CBC, SK-EN, 1, CBC, SLS-Permanent, 1
   NAME=SLS-EN, CONC, STRENGTH, 0, 1, , 0, 0, 0
        CBC, SLS1-D+CS+HA, 1, CBC, SLS1-D+CS+HA&HB, 1, CBC, SLS2-D+CS+W+HA, 1
        CBC, SLS2-D+CS+W+HA&HB, 1, CBC, SLS2-D+CS+WOL, 1
        CBC, SLS2-D+CS+FL+HA, 1, CBC, SLS2-D+CS+FL+HA&HB, 1
        CBC, SLS3-D+CS+TU+HA, 1, CBC, SLS3-D+CS+TU+HA&HB, 1
        CBC, SLS4-D+CS+TR+HA, 1, CBC, SLS4-D+CS+TR+HA&HB, 1
        CBC, SLS4-D+CS+SK+HA, 1
   NAME=ULS-SUPER, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, SERVICES, 1.2, CS, SELF_WEIGHT, 1.15, CS, PARAPET+SERVICES, 1.2
   NAME=SLS-SUPER, CONC, STRENGTH, 0, 0, , 0, 0, 0
        ST, SERVICES, 1, CS, SELF_WEIGHT, 1, CS, PARAPET+SERVICES, 1
''')

# 结束
result.write('''
*ENDDATA
''')

# 关闭写入文件
result.close()


